how to fix NPM install packages, that give an error back - node.js

Here's the screenshot of the error
After installing (npm init) I try:
$ npm install express
Same thing happens if I try to install any other package.
npm ERR! code UNKNOWN
npm ERR! syscall open
npm ERR! path C:\Users\user\AppData\Roaming\npm-cache\_cacache\index-v5\c3\ae\1314e79200fca71af4663702ee1e676113e408ca8a468a396de5ab6d5d2b
npm ERR! errno -4094
npm ERR! UNKNOWN: unknown error, open 'C:\Users\user\AppData\Roaming\npm-cache\_cacache\index-v5\c3\ae\1314e79200fca71af4663702ee1e676113e408ca8a468a396de5ab6d5d2b'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-05-17T17_14_26_890Z-debug.log
What might this error be?

Remove following directory and try again npm update. It works for me.
C:\Users\user\AppData\Roaming\npm-cache

Some issues can be solved by clearing the cache with npm cache clean.
Run this command and try again. If it still doesn't work, use the -verbose argument to get more output on the installation to see more details.

Related

npm install always gives 'Your cache folder contains root-owned files, due to a bug in npm previous versions of npm which has since been addressed.'

I am currently using Ubuntu 18.04.4 and I am trying to install something using npm install but it always gives the error below. I tried other aliases as well (npm i, npm add) but the error persists.
npm install
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path /home/dell/.npm/_cacache/content-v2/sha512/14/21/2143fe2b135cd8bfdad85c9c3f9ac46ab279a58dee631cfea1b9678167bd388d44f2d36739019c96ba3a4c4756b1ea6570f4dc8931fb8ad8230359521f80
npm ERR! errno -1
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1001:1001 "/home/dell/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dell/.npm/_logs/2020-07-30T17_16_58_257Z-debug.log
When I run the sudo chown -R 1001:1001 "/home/dell/.npm" command, it does nothing, and the error remains when I run npm install again. I have also searched StackOverflow and other platforms for the answer, but no solution seems to solve this problem.
P.S: My node version is 12.18.3 and npm version is 6.14.6.
If someone can help me resolve this, I would really appreciate it!
I had problem with create-react-app. Solve it using yarn.
yarn global remove create-react-app
then
yarn global add create-react-app
and
create-react-app MyApp

Cannot run "npm run watch", error message brings up "gulp" error

I am using a web starter kit from coding phase GitHub that normally works fine for me. for some reason when i attempt to run npm run watch it gives me error messages. I'm not 100% positive but I believe this begun when I updated my I did an uninstall and re-install of nodeJS. help me out!
sh: gulp: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! starter-kit-2019#1.1.0 watch: `gulp`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the starter-kit-2019#1.1.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/joseperez/.npm/_logs/2018-12-20T02_45_19_840Z-
debug.log
Its because we are using 'gulp' as a global module. So when you removed node from your system, it removed the gulp which is a package installed.
You can reinstall it by using
`npm install gulp-cli -g`
And it will work!
Update:
He is using a mac so try running this command.
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli`
Hope this info turns out useful to someone after doing research on an error that was coming up on my console stating, "gulp: command not found" I found a link that addresses how to fix this. turns out my gulp was not installing properly because there was an issue with my path. btw I am using a Mac machine below is the link that helped me out!
here is the link that helped me out!

npm i Running command - failed! (exit code 254)

Ionic :3.20.0
node: v8.10.0
npm: 5.6.0
npm i
✖ Running command - failed!
[ERROR] An error occurred while running npm i (exit code 254):
npm ERR! path
/Users/lucaszimmermann/Desktop/myApp/node_modules/tsickle/src/main.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod
'/Users/lucaszimmermann/Desktop/myApp/node_modules/tsickle/src/main.js'
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/lucaszimmermann/.npm/_logs/2018-04-04T16_41_39_270Z-debug.log
I faced a similar issue after doing the below actions this issue solved.
Delete package-lock.json file.
Open cmd/terminal in administrator mode.
run command: npm install
run command: npm update
Node version is likely incompatible. There'd be an expected version actual version. Use nvm or similar to install and change node versions.
Delete node_modules and try install again. You probably get a message similar to:
error ts-jest#26.1.2: The engine "node" is incompatible with this module. Expected version ">= 10.21.0". Got "10.20.1"
error Found incompatible module.
You wan't try to install npm packages.
You have two options to install some packages:
First Option:
npm install <package>
npm i <package>
Second Option:
If you wan't to create an automated installation process without each package, you must provide an packge.json - Here are all depencies listed. You can only run npm i or npm install without an package name, if you have an package.json
A full documentation about that is on NPM: https://docs.npmjs.com/files/package.json

unable to install firebase tools cli using windows 10

Hi i unable to install the firebase tools via commandline in the windows
im using this below command
npm install -g firebase-tools
after entering this command i m getting this below error
npm ERR! path C:\Users\data\AppData\Roaming\npm\node_modules\firebase-tools\node_modules
npm ERR! code ELOOP
npm ERR! errno -4067
npm ERR! syscall mkdir
npm ERR! ELOOP: too many symbolic links encountered, mkdir 'C:\Users\data\AppData\Roaming\npm\node_modules\firebase-tools\node_modules'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\data\AppData\Roaming\npm-cache_logs\2018-01-20T13_22_41_404Z-debug.log
Latest version seems to have a problem.
Try installing one previous version:
npm i -g firebase-tools#v3.17.2
UPDATE:
Before doing so, it might be better to uninstall faulty one:
npm uninstall -g firebase-tools
also make sure you have windows-build-tools installed (though I have it on my machines, error you share doesn't really seem to be related to this)
npm --add-python-to-path='true' --debug install --global windows-build-tools
UPDATE 2
I've updated my Node & NPM versions and then to latest Firebase Tools.
Still getting WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 error, but since it's a warning, I've decided to give it a try. So far no problems.
UPDATE 3
windows-build-tools package got an update yesterday so I installed it with hope it solves problems installing latest version of firebase-tools. It did not, same errors occur.
Actually you can try installing the
npm i -g firebase-tools#v3.16.0 version and try to install the
npm install windows-build-tools**in your local folder and after that install
**npm install node-gyp in your local folder and before doing all these try to disable your antivirus
npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/#google-cloud%2fpubsub/firebase-tools/firebase-tools npm ERR! 404 npm ERR! 404 'firebase-tools#latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jsmma\AppData\Roaming\npm-cache_logs\2020-05-02T14_58_23_615Z-debug.log

npm install error web project

When I try install npm modules I see the following problem:
PS C:\Users\maxzag\Desktop\svoi> npm install
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\maxzag\AppData\Roaming\npm-cache\_logs\2017-08-15T11_25_41_473Z-debug.log
Can someone already come across this problem and can something advise?
This might be your issue: https://github.com/npm/npm/issues/17858
Try removing node_modules and running npm install again.

Resources