React library vulnerability and risk - javascript

Hello I recently installed react-redux and saw on my console after it was downloaded that there were vulnerabilities low and high. What does this mean? Should I uninstall it?

Npm installer include audit system of scanning your project for vulnerabilities. You can try to run this command to automatically fix vulnerabilities, maybe it will update version of react-redux or some dependencies
npm audit fix
You can try to read this answer https://stackoverflow.com/a/50574347/4459474

Chances are this warning was caused by other library you have also installed.
Try to execute npm audit fix command to let npm attempt to auto fix vulnerabilities.

Related

I keep getting an error in Vite version 3.2.4 which says `[vite:esbuild] The service is no longer running: write EPIPE`

After creating a vite app. I run the command npm run dev and I get this error
[vite:esbuild] The service is no longer running: write EPIPE
Please, How do I solve this error.
I have tried the following solutions
Vite build fails with esbuild error
error while transforming /app/client/vite.config.ts with esbuild in Docker image
Turn off your Antivirus Software
Disable your antivirus software then go ahead and run:
npm run dev
I found a solution to my problem. If you have an anti-virus, you need to uninstall it.
I myself, I had to uninstall SMADAV anti-virus.

Cypress failed to start. This may be due to a missing library or dependency (M1 mac)

I just got my M1 and trying to get my head around cypress so basically following basic steps in order to open cypress and check if its there and its possible to run it.
mkdir cypress_test
npm init -i
npm install --save-dev cypress
npx cypress open (thats where issues appears)
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
Please refer to the error below for more details.
Command failed with Unknown system error -86: /Users/test/Library/Caches/Cypress/9.6.1/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=610
spawn Unknown system error -86
I have attempted trying to install cypress with force with the following command -
npx cypress install --force however sadly it did not help and same error appears
I also saw somebody manage to fix it by changing Mac with M1 chip to OS ver. 11.5.x (BigSur) however is not something i would like to do.
Any help is appreciated
Thanks.
The only way that i managed to sort this out is by install Rosetta 2 that transitions between Intel and Apple processors.
softwareupdate --install-rosetta --agree-to-license
https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/
The Problem
At the moment, Cypress cannot be compiled under the ARM-based architecture of new Mac computers and Continuous Integration (CI) providers do not currently offer M1 instances. For these reasons, Cypress is not currently released for the ARM-based architectures and will require Intel emulation for some time.
Therefore, running npm install cypress will install the Intel-based package until these challenges are resolved. See here for workaround
See here for more info https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/

I am facing the problem to install react-currency-format?

I I'm facing the issue for install react- currency- format because of latest version of react 18 i can easily install with the help of force save....but i have doubts if i m doing this then it will creat issues with my system
currently the react-currency-format does not work with the 18.0.0 and above to get the react-currency format to work you will need to downgrade your react to react ^17.0.0 in your package.json file after deleting your package-lock.json
another option is to add --force to the end of the install command like so
npm install react-currency-format --save --force
or you can also use
npm i react-currency-format --save --force
Your Welcome
Welcome to the community! Here is a set of questions can work as clarification, for your kind information.
Ques: Is react-currency-format well maintained?
Ans: We found indications that react-currency-format maintenance is sustainable demonstrating some project activity. We saw a total of 20 open source contributors collaborating on the project.
Ques: Is react-currency-format safe to use?
Ans: The npm package react-currency-format was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as safe to use.
Hope both of above mentioned q/a gives you a "aha" moment.
Reference: https://snyk.io/advisor/npm-package/react-currency-format

NPM Install giving rollbackFailedOptional

After trying to use the Windows Powershell (as an admin), the command prompt (as an admin) and the bash CMD; I repeatedly get the following error after trying an npm install command:
npm install npm#latest -g
is the attempted command and...
[...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx
where the 'x's represent different letter and number combinations at each attempt, is the message. I am aware that this should be the first step in the installation of a package but it remains on this message for a long time and will not change.
I am trying to use the JavaScript React library, more specifically the 'create-react-app'. The npm install -g create-react-app command is also causing the error.
npm version: 6.5.0
npx version: 10.2.0
node version: 10.15.0
A solution would be greatly appreciated.
https://docs.npmjs.com/try-the-latest-stable-version-of-npm In this link there is the documentation for updating npm version for windows with a link to a tool developed by Microsoft to update npm (https://github.com/felixrieseberg/npm-windows-upgrade)
I found the solution:
As my device username has both my first and last names, with a space in between, npm was reaching errors because of this. So the solution was to uninstall node from the default location and reinstall it in a folder on my C:\ drive, where there were no files in the directory that have spaces in the names. I then changed the cache location into this same C:\ drive folder, and the problem was solved.
npm config set cache C:\NODEJS\npm-cache
(these folders must be created before you can set the config directory to these.)
For me, I ended up having to:
Uninstall Node.js
Remove the folder "nodejs" completely from C:\Program Files (or
wherever you decided to install node)
Reinstall Node.js
After that, I did not encounter [...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx anymore.
I'm not quite sure what the issue was but all suggestions I found on stack did not solve this problem for me. I hope this helps someone.
Check if you are connected to any other VPN or proxy setting. If so try to disable it or disconnect from it and then execute the npm command. It worked for me. In my case, I was using the organization laptop and was connected to external vpn network, so i disabled the vpn and tried the command and it worked.
In our case the hard disc of the nexus server (repository server) was just full. Maybe someone helps this. Before looking into other more complicated options.
for my case i uninstalled the reinstelled it and used powershell insted of cmd and it worked like a charm
First run these commands.
npm config rm proxy
npm config rm https-proxy
then run this.
npm config set registry https://registry.npmjs.org/
check if the internet is connected
and try to run the npm command which was giving the error.

npm - EPERM: operation not permitted on Windows

I ran
npm config set prefix /usr/local
After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.
Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)
Have deleted all files from
C:\Users\<your username>\.config\configstore\
It did not work.
Any suggestion ?
Running this command was my mistake.
npm config set prefix /usr/local
Path /usr/local is not for windows. This command changed the prefix variable at 'C:\Program Files (x86)\Git\local'
To access and make a change to this directory I need to run my cmd as administrator.
So I did:
Run cmd as administrator
Run npm config edit (You will get notepad editor)
Change prefix variable to C:\Users\<User Name>\AppData\Roaming\npm
Then npm start works in a normal console.
This is occurring because windows is not giving permission to the user to create a folder inside system drive. To solve this:
Right Click
The Folder > Properties > Security Tab
Click on Edit to change Permissions > Select the user and give Full Control to that user.
Sometimes, all that's required is to stop the dev server before installing/updating packages.
I solved the problem by changing windows user access for the project folder:
Here is a screenshot:
http://prntscr.com/djdn0g
Restarting VsCode solved it for me!
I recently had the same problem when I upgraded to the new version, the only solution was to do the downgraded
To uninstall:
npm uninstall npm -g
Install the previous version:
npm install npm#5.3 -g
Try update the version in another moment.
I use Windows 10.
I started the CMD as administrator, and it solved the problem.
Find CMD, right click, and click open as administrator.
I had an outdated version of npm. I ran a series of commands to resolve this issue:
npm cache clean --force
Then:
npm install -g npm#latest --force
Then (once again):
npm cache clean --force
And finally was able to run this (installing Angular project) without the errors I was seeing regarding EPERM:
ng new myProject
In my case, I was facing this error because my directory and its file were opened in my editor (VS code) while I was running npm install. I solved the issue by closing my editor and running npm install through the command line.
I had the same problem, after updating npm. Solved it by re-installing latest npm again with:
npm i -g npm
but this time with cmd running in administrating mode.
i did all this because i suspected there was an issue with the update, mostly some missing files.
I had the same problem when I tried to install the npm package AVA. The solution for me was to delete the node_modules folder and force-clean the npm cache:
rm -rf node_modules
npm cache clean --force
I could then install the npm package without a problem.
for me it was an issue of altering existing folders in node_module, so i nuked the whole folder and run npm install again. it works with no errors after that
Just run cmd as admin. delete old node_modules folder and run npm install again.
The Problem I faced (In Windows Computer)
When I was trying to install a couple of npm packages I got the following error:
npm - EPERM: operation not permitted - while npm was trying to rename a file
Here's my debug snippet for reference, if you've faced the similar problem:
After carefully checking out the answers from other users, I have created a detailed answer for the community
My Solution for the problem
Follow the mentioned steps
Right-click on the project folder
Go to properties -> Security Tab
Select Users -> Edit
In the Permission for Users section, Full control -> Give a check mark in Allow -> OK
Wait for Windows security to apply the new security rules
Click OK
Visualization of the steps
If you follow these steps and try to install npm packages again it will work properly.
Note: It's a best practice to close and open up the command line again to experience the changes
Simplest way
Hope I am not too late for this post but recently even I too got hit by this issue. And also I had no admin rights on my laptop.
Here is the simplest way I fixed the bug.
Locate the file name .npmrc (it will be in C:\Users\<user name>\.npmrc)
Open it and change the path of prefix= to prefix=C:\Users\<user name>\AppData\Roaming\npm
hope it will be helpful..
Happened to me since the folder/file was locked by another process. Used a tool (LockHunter) to terminate that process and it started working again (possible reason).
If you getting this error in an IDE's terminal/commands prompt, try delete node_modules, close IDE, and run the npm install command again.
The time when IDE started but still not completed its analysis of node_modules tree is a tricky moment, when packages installation may fail because IDE still scanning node_modules contents.
This error is caused by different problems try the below one of them will work for you!
try to run npm as Administrator
Run cmd as administrator npm config edit (You will get notepad editor)
Change Prefix variable to C:\Users\<User Name>\AppData\Roaming\npm
The errors went after I disabled my anti-virus (Avast)
Sometimes a simple cache clear like the below would fix it.
npm cache clear
For me the problem come from bash terminal. I change my terminal to powershell and it's ok.
Really easy to resolve
Find this command npm cache clean as a solution to those error in quick and simple way!
I updated my node version to 8.9.4 and ran the necessary install command again from administrator command prompt. It worked for me!
A reboot of my laptop and then
npm install
worked for me!
Running npm commands in Windows Powershell solved my issue.
Try npm i -g npm . NPM version 6.9 is work to me.
Apparently anti-virus software can also cause this error. In my case I had Windows Security's Ransomware Protection protecting my user folders which caused this error.
Windows 10,
Running the IDE (in my case IntelliJ) in administrator mode and executing npm install does resolves the problem.
If no IDE then run CMD in administrator mode and try executing npm install
For those trying to update config
If having trouble updating your npm config, try instead running using the -g flag. This solved the issue on Win 10 for me after trying everything else.
npm config edit -g
I am able to update the config and changes are reflected everywhere. This may be due to running npm in an organizational scope.
I was running create-react-app server. Simply stopped the server and everything worked just fine.
The simpler way to solve this by entering the below command
npm config set cache C:\tmp\nodejs\npm-cache --global
At least I just solved my problem in this way:
Search cmd
Then run as administrator
Then npm i -g expo-cli or npm config set prefix /usr/local
I just solved my problem.

Categories

Resources