[英]Installing lighthouse - Issues with npm package
I'm trying to install lighthouse in the terminal using我正在尝试使用在终端中安装灯塔
npm install -g lighthouse
But I get the following error.但是我收到以下错误。 Note: "<user-name" replaces my name
注意: “<user-name”替换我的名字
(base) X-136:~ <user-name>$ npm install -g lighthouse
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/<user-name>/.npm-global/lib/node_modules/lighthouse
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/<user-name>/.npm"
It seems to be that npm is placed under global, which is what is needed.好像是把npm放在global下面,这个是需要的。 Any advice on what to do?
关于做什么的任何建议? I have tried to run the sudo code but doesn't do anything.
我试图运行 sudo 代码,但什么也没做。
(base) X-136:~ <user-name>$ npm list -g
/Users/<user-name>/.npm-global/lib
Many thanks非常感谢
If you are using linux, you can try with sudo command,如果您使用的是 linux,您可以尝试使用 sudo 命令,
sudo npm install -g lighthouse
At the end to solve the issue, I cleaned up the computer and reinstall all again, as an old package was interfering.最后为了解决这个问题,我清理了电脑并重新安装,因为旧的 package 正在干扰。 Then give the correct privileges.
然后赋予正确的权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.