简体   繁体   English

npm 安装总是给出“您的缓存文件夹包含根拥有的文件,由于 npm 以前版本的 npm 中的错误,该错误已得到解决。”

[英]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.我目前正在使用 Ubuntu 18.04.4 并且我正在尝试使用npm install安装一些东西,但它总是给出以下错误。 I tried other aliases as well ( npm i , npm add ) but the error persists.我也尝试了其他别名( npm inpm add ),但错误仍然存在。

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.当我运行sudo chown -R 1001:1001 "/home/dell/.npm"命令时,它什么也不做,当我再次运行npm install时,错误仍然存在。 I have also searched StackOverflow and other platforms for the answer, but no solution seems to solve this problem.我也搜索了 StackOverflow 和其他平台的答案,但似乎没有解决方案可以解决这个问题。

PS: My node version is 12.18.3 and npm version is 6.14.6. PS:我的节点版本是12.18.3,npm版本是6.14.6。

If someone can help me resolve this, I would really appreciate it!如果有人可以帮助我解决这个问题,我将不胜感激!

I had problem with create-react-app.我对 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM