I cannot install npm with node, any ideas? [duplicate] - npm

I keep getting the same error message when trying to create a new angular project.
I tried to create a new angular project using Windows Powershell with the following commands:
ng new hello-world
-> Would you like to add angular routing? - Yes
-> Stylesheet format? - CSS
I obtained the error message below. I already tried to reinstall angular cli and I'm running Powershell using Administrator.
Installed versions:
Angular CLI: 8.0.6
Node: 10.16.0
OS: win32 x64
Error message:
npm WARN tarball data for tslint#~5.15.0 (sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for jasmine-spec-reporter#~4.2.1 (sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for acorn#^6.0.5 (sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for #angular/language-service#~8.0.3 (sha512-04XojOo9FJgEQE/rZafnaJQxPEU+//TSzTgpGoIVzCSMx+joCY/ZSSwJZPWxiHlOE57W/zX02ZY+TwcM81oTdw==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\#angular\platform-browser-447d0944\esm2015\animations\src\animation_builder.js'
npm ERR! path C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif',
npm ERR! parent: 'hello-world' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm WARN tar EPERM: operation not permitted, lstat 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\#angular\router-8388bfd5\esm2015\src\directives'
npm WARN tarball tarball data for typescript#3.4.4 (sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==) seems to be corrupted. Trying one more time.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\konta\AppData\Roaming\npm-cache\_logs\2019-07-01T01_21_13_653Z-debug.log
Package install failed, see above.

I found the problem: My antivirus was somehow blocking the files without me knowing. It worked once I paused my antivirus during the installation.

In windows10 I disabled the windows defender / windows security ==> realtime protection and try again npm install command and it worked
1.
2.
3.
NOTE : Turn on the real time protection again after installation complete.

Restarting the machine worked for me.

I had this problem on MAC. I just added 'sudo' before the command and it worked.
sudo npm install -g parcel-bundler

I tried opening CMD with Run as Admisnistrator then run npm i and it worked for me

I'd just like to add a small little answer based on Qadir Hussain's answer.
If you disable "Realtime Protection" in Windows Security, you're going to leave your laptop or PC vulnerable to any viruses that may infect it when "Realtime Protection" is off. This may seem a bit impossible if you're only installing an NPM package, but some apps may have a hidden background process waiting for "Realtime Protection" to be disabled, and when it is, it could inject a virus.
That been said, there's still an option.
First things first, open Windows Security by typing "Windows Security" in the Start Menu and tap "Open".
After that, go to "Virus & Threat Protection".
Next, scroll down until you find "Manage Settings" under "Virus & Threat Protection Settings".
Then, scroll down until you see "Exclusions". Under "Exclusions" there's a link that says "Add or remove exclusions".
Once that's done, tap the button that says "Add an exclusion". Then tap "Folder" on the drop-down menu.
Choose the node_modules directory that is giving issues.
Last but not least, Allow administrative permissions.
Finally, exit Windows Security.
I wouldn't recommend excluding your entire Projects folder, as that will disable all scans for the directory.
Small disclaimer here, I'm only making this answer as a means of helping others without disabling "Realtime Protection". While I'm not encouraging this, this might help fix a common problem.
Have a good day. :)

For me, there are several possibilities:
Intercepted by anti-virus software, resulting in inoperability.
It is locked by IDE, resulting in inoperable.
The task is locked by npm running, resulting in inoperable.

Cancelling the npm start process and closing the terminal window (I use Hyper Terminal) worked for me (using Win 10).
I was then able to uninstall an npm package and install another.

I had visual studio code running. I turned it off and boom! worked for me!

To me, using Windows 10 the only thing that solved this problem was: exclude the node_modules folder, open Visual Studio Code in Admin mode in the project folder, and execute the following command:
npm install -g --unsafe-perm

For me the issue was with npm version I was using. I changed to a npm version which did not have the bug by using the below command:
npm install --global npm#8.3.1
I found this solution in a github issue:
Link to github issue
Hope it helps you like it did me!

was facing this problem and this is how it got solved :
-stoping the execution of the development server for both front-end and backend:

two things:
try admin.
make sure other processes does not occupying the folder/file
with me, it was not related to antivirus.
it appears that a process occupied this folder. in my case a node process occupied my node_modules folder.
i found it out by using process-explorer - i searched the path end found that a node process using this folder(even though I closed it! very common in windows), so i ended this process and then i did not got this error anymore.

I had the same issue What I have done wrong is I had set the npm registry to a local registry, without knowing that I faced this issue once I reset to globally using npm config set registry https://registry.npmjs.org/ error went away.

I tried everything above.
Deleting node_modules and re-installing did the trick for me.

This happened when I tried installing a new npm dependency, jest, with:
npm i --save-dev jest
I got it working by simply rerunning the command.

Related

"PulseTile-RA" cannot run. Is it an npm dependency issue?

I wanted to experiment with this project based on react-admin:
https://github.com/PulseTile/PulseTile-RA
So I downloaded the code, run npm install and I got a lot of errors from NPM mainly axios version corrupted.
Example:
npm ERR! code EINTEGRITY
npm ERR! sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI= integrity checksum failed when using sha1: wanted sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI= but got sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g== sha1-/z8N4ue10YDnV62YAA8Qgbh7zqM=. (75833 bytes)
npm WARN tarball tarball data for js-yaml#3.13.1 (sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==) seems to be corrupted. Trying one more time.
npm ERR! code EINTEGRITY
npm ERR! sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== integrity checksum failed when using sha512: wanted sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== but got sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==. (74050 bytes)
npm WARN tar ENOENT: no such file or directory, open 'C:\nodejs\xxx\PulseTile-RA\node_modules\.staging\babel-plugin-transform-object-rest-spread-7e34a6f0\package.json'*
When I do npm start I get an error that react-scripts doesn't exist.
I tried workarounds for similar errors on stackoverflow but without success. And yet still, I cannot get it to run. I have latest NPM, node on windows 10.
Please advise on NPM issues as I think this is the source of this project issue of not starting.
Thank you
So technically, this has more to do with npm than the actual project.
In fact, this issue reported to the npm repository would help.
But here are some quick steps that should help:
Since you're in windows-10, it's advisable to run the "delete" commands within git bash.
Go to the project directory (root folder)
Delete the node_modules directory: rm -rf node_modules
Delete package-lock.json file:rm package-lock.json`
Clear the cache: npm cache clean --force
Run npm install --verbose
If it doesn't help, then please follow more instructions here

npm EACCES error again after fixing it

I was having an issue where I couldn't use npm to install things globally and I fixed it by following the instructions here and making a .npm-global directory. My computer restarted and updated software and now it doesn't work again and I redid the instructions but its not helping. Any idea what could be happening?
$ npm install -g express-generator
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied,
After following the instructions here like I said https://docs.npmjs.com/getting-started/fixing-npm-permissions it worked for a bit but then stopped working. What fixed it was resetting my prefix.
npm config set prefix ~/.npm-globall
The tip at the bottom is actually more useful.
"If you are using npm version 5.2 or greater, explore npx as an alternative way to run global commands, especially if you just need a command occassionally. Click here to read an excellent article about npx."
npx works great.
https://docs.npmjs.com/getting-started/fixing-npm-permissions

npm install host key verification failed

I ran npm install in angular2+ project directory and got below error which I cannot understand at all.
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\bin\git.EXE ls-remote -h -t ssh://git#bitbucket.org/path/projectname.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
I have created ssh key on bitbucket and account and saved it on drive. |
I have clone project from bitbucket.
What does this error has to do with that?
As I am new on project so don't have much knowledge.
Do I need to provide ssh key while npm install as well?
Please let me know if I can provide more info related to question.
Thanks!
Please check the npm version that you are using. Npm comes bundled with node and you shouldn't have multiple instances on your classpath.
Hey yup, I thought as much, but seeing as I had updated npm to the
latest version ( I even uninstalled node and reinstalled ) with the
same result. npm -v still showed the same version - 1.4.9.
FYI for others that may have the same issue. I also have Chocolatey
installed, and it seems that npm was also installed via Chocolately
which seems to overide the npm path. Uninstalling npm from Chocolately
resolved the npm version issue.
After that angular/cli installs correctly from npm.
https://github.com/angular/angular-cli/issues/6313#issuecomment-301360623

`npm install` gives ENOENT errno -2 re missing dezalgo module

I'm trying to run npm install for a little ember-driven site that I've got, but it throws the following error:
npm ERR! path /Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/dezalgo
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/dezalgo' -> '/Projects/Etc/Admin/cuscus/node_modules/npm/node_modules/.dezalgo.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mick/.npm/_logs/2018-01-09T01_18_51_322Z-debug.log
If I delete the node_modules directory completely then run npm install again it seems to work, but running it again fails.
What you can try is:
Be sure that you use cmd promt in Admin mode.
If you use VS Code, kill all node procceses. Close it and try again.
Delete package-lock.json and node-modules folder and try again.
Change the node version. For example try the old one v6.11.2
Try to do npm cache clean --force
Try to remove {package}.DELETE in ~/AppData/Roaming/npm/node_modules after the initial npm i -g {package} and retry npm i -g {package}
One of it can help. But not for sure. The status of issue with this problem is open for the moment.
https://github.com/npm/npm/issues/17444
I just had this issue when setting up a new machine. None of the cache clean/uninstall/reinstall steps worked for me.
However, I was able to resolve it by updating npm to the latest version. I had 5.6.0 installed, but using npm-windows-upgrade to install the latest version (5.7.1) cleared up the dependency issues.
See this answer for more information on upgrading npm on Windows:
https://stackoverflow.com/a/31520672/91189
This most likely happened because you updated your node version and because you probably already had this repo sitting on your machine before that particular update, the package-lock.json file whose sole purpose is to track the present and past state of your node_modules file and maintain a very updated dependency tree such that amongst entities using your code there will be consistency installing exactly the same dependencies ;
Entities using your code include
Teammates
Deployments (AWS ECS),
and Continuous integration tools like Travis CI that are running your code,
Try to delete the package-lock.json file. Run the npm install command and you should be fine.
The last thing you should try doing is deleting the missing package if you are not sure of what you are doing, it's usually better to avoid this.
Goodluck.

Error: EPERM: operation not permitted, unlink 'D:\Sources\**\node_modules\fsevents\node_modules\abbrev\package.json'

I just updated npm to 5.4.0.
Now, Whenever I want install a npm package I get the following error:
D:\Sources\DownloadCms\Md.Download\Web.Angular>npm install mds.angular.datetimepicker#latest --save
npm ERR! path D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.jso
n'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'D:\\Sources\\DownloadCms\\Md.Download\\Web.Angular\\node_modules\\fsevents\\node_modules\\ab
brev\\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'D:\\Sources\\DownloadCms\\Md.Download\\Web.Angular\\node_modules\\fsevents\\node_modules\\abbrev\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mohammad\AppData\Roaming\npm-cache\_logs\2017-09-03T03_25_50_432Z-debug.log
I'm dead sure, run CMD as administrator.
Also I checked D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json\, package.json is not exist in path !
Edit:
Upgrade to v5.4.1, still get the same error, even cannot work around with --no-optional :-(
I was able to fix this by running the command prompt/bash as admin and closing VSCode!
Seems like VSCode was locking some files.
Potentially something else could be locking these files for you.
It is an npm 5.4.0 issue https://github.com/npm/npm/issues/18287
Workarounds are
downgrade to 5.3
try running with --no-optional, i.e. npm install --no-optional
Please close all IDE like visual studio code. run npm install command through node.js command prompt.
Enjoy !
If you downgrade to 5.3 and still get the same error in Windows like me.
After hours working with npm versions I found the following solution:
1. Download latest recommended version of nodejs, these days is node-v6.11.3-x64
2. Uninstall nodejs with it.
3. Go to C:\Users\{YourUsername}\AppData\Roaming folder and delete npm and npm-cache folders
4. Run installer of nodejs again and install it
5 Update npm to 5.3 with npm i -g npm#5.3 command line
Now you should use npm without any issues.
I tried this solution found at a How to fix Node.js blog
just use
npm cache clean
in windows if it refuses use
npm cache clean --force
cache clean and npm update to latest with force work for me
npm cache clean --force
npm install -g npm#latest --force
I fixed by downgrading npm from 5.4.0 to version 5.3
npm i -g npm#5.3
I Hope this helps for you
I had the same problem on Windows.
The source of the problem is simple, it is access permission on folders and files.
In your project folder, you need
After cloning the project, change the properties of the folder and change the permissions of the user (give full access to the current user).
Remove the read-only option from the project folder.
(Steps 1 and 2 take a long time because they are replicated to the entire tree below).
Inside the project folder, reinstall the node (npm install reinstall -g)
Disable Antivirus. (optional)
Disable Firewall. (optional)
Restart PC.
Clear the npm cache (npm clear)
Install the dependencies of your project (npm install)
After that, error "Error: EPERM: operation not permitted, unlink" will no longer be displayed.
Remember to reactivate the firewall and antivirus if necessary.
I had the same issue and all I needed to do was login to npm
npm login
or alternatively
npm add user // consult the documentation for the params
For those who are coming from Windows OS, you just need to stop the development server and then execute your npm install ... command.
It is strange how Windows doesn't allow installing dependencies while server is running, but MacOS does allow.
If this doesn't work, then only go for the other options - clean cache, downgrade nodejs etc.
If all of the above failed to work for you, you might want to
restart your system
run command prompt as admin
run the npm command
In my case, the problem was that, I did not install typescript. Although I did install Node and Angular.
To check if you have installed typescript or not
Run this command: tsc -v
If not, then to install typescript
Run this command: npm install -g typescript
And, finally to install required dependencies
Run this command: npm install
in the root folder of the project.
---- Hope this helps someone ----
I had this logs in Windows.
I did the following
Close Visual Studio Code
Run Command Line as admin
Deleting package-lock.json fixed it for me.
I'm using VsCode and solved this issue by stopping the application server and them run npm install. There are files that were locked by the application server.
No need to close the IDE, just make sure there's no another process locking some files on your projects.
Mine was as a result of opening my project folder a 2 different terminals. I solved it by closing all running terminal (vs code was excluded) and executing the installation command again.
I hope this helps someone.
NB: deleting node_modules didn't solve it.
For me it worked in bash from git package
try:
C:\Program Files\Git\bin\bash.exe
then:
npm install mds.angular.datetimepicker#latest
There seems to be many solutions out there that worked with downgrading npm versions. For me, the solution was
npm install -force
I tried the downgrading of npm versions, modifying my npm prefix config to match the npm directory, and clearing cache. None of these worked, but apparently they worked for others, so it may be worth a shot.
For me on Windows the problem was too long path length. I moved the project to a smaller length path and it worked.
Deleting my node modules folder and running a normal npm install did it for me
For me it was Docker...
The moment that I closed the app container, I could do an npm install without any proble
P.S My node version is 14.15.5
I fixed this by removing the dist folder
--- Remove dist or public folder
the same error comes to me when i update the npm version to the latest 5.4
downgrade to the version 5.3.0 is useful.the error comes from the npm 5.4,you can check it in the issuses in npm 5.4
npm install npm#5.3 -g
Fixed in NPM 5.6.0
Upgrade to NPM 5.6.0 solved problem for me.
I wanted to run npm install from within my external hard drive as this is where i saved my code workspace. Windows 10 OS.
But I was getting the same error as the original post.None of the previous answers worked for me, I tried all of them:
uninstalling nodejs then re-installing
uninstalling nodejs then downgrading/installing a lower version of nodejs.
npm install -force
deleting the folders from C:\Users{YourUsername}\AppData\Roaming ... npm and npm-cache then re-installing.
npm cache clean --force
npm cache clean
npm install --g or npm install --global
What worked for me was this:
copy the folder from C:\Program Files\nodejs to D:\Program Files\nodejs
Then go to Control Panel\System and Security\System
Advanced System Settings
Environment Variables
System Variables
Double click Path
Add a new path
D:\Program Files\nodejs
Click ok
restart PC.
try npm install from within D: Drive
npm cache verify solved my issue.
I was doing: ng new my-app
and I faced similar error
I have
node version: 10.16.0
npm v 6.9.0
After trying everything, including node/npm upgrade, cache cleaning and reverting code, nothing helped besides one simple thing: Turning OFF Windows 10's Real-time protection during the dev/build. Looks like latest updates made it super aggressive.
npm login is required before publish
For windows,
Download latest recommended version of nodejs, these days is node-v6.11.3-x64
Uninstall nodejs with it.
Go to C:\Users\{YourUsername}\AppData\Roaming folder and delete npm and npm-cache folders
Run installer of nodejs again and install it
By default npm 3.10.10 should be installed along with node-v6.11.3-x64.
It worked for me with npm 3.10.10 but did not work with 5.3.X.
Also it did not worked with higher versions of node (above
node-v6.11.3-x64)
My problem was executing the command (npm audit fix all). I solved it when closing VSCODE and re-executed the command without problems.