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.' - node.js

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

Related

uninstalling broken node packages for react native

I am working on a react native app and I had to install node and expo-cli to start the app but recently I have been having issues with running the app. When I run npm start, I get the error expo: command not found so I install the expo-cli using npm install --global expo-cli I get this error:
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /Users/{usr}/.npm-global/lib/node_modules/expo-cli
npm ERR! dest /Users/{usr}/.npm-global/lib/node_modules/.expo-cli-F3yBqKce
npm ERR! errno -13
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 501:20 "/Users/{usr}/.npm"
I ran the sudo chown -R 501:20 "/Users/{usr}/.npm command but it still does not work.
So I tried to uninstall node and start all over but the issue still persists. Does anyone know a way to fix these issues? Like is there a way I can reset my packages or something like that?
Thanks in advance!

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!

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.

Angular 2/4 npm install issue

When i try to to install angular via npm i get this error message:
npm install -g #angular/cli
npm ERR! path C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\acorn' -> 'C:\Users\myname\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\.acorn.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! C:\Users\myname\AppData\Roaming\npm-cache\_logs\2017-07-26T15_20_28_022Z-debug.log
current setup:
node -v
v6.11.1
npm -v
5.3.0
VOILA!! I found the answer. Actually i can't claim that is a real answer to the problem but it worked damn well. So what i did is, i ran bash as administrator (i did this many times before but didn't worked), and i did next:
$npm cache verify (to see what will happen after i deleted some stuff, uncompleted angular package in node_modules directory for example)
$npm update ( update all outdated local packages )
$npm update -g ( update global packages )
$npm install -g #angular/cli
Maybe running bush as administrator wasn't necessary, maybe just npm update was enough. Anyway, i hope this solution will be helpful to someone.

Resources