为什么 npm install 报错 code ENOENT errno -2?

图片描述

即使加上sudo也是报同样的错误

npm ERR! path /var/www/Activity/src/main/resources/templates/Christmas/node_modules/abab
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! endent ENOENT: no such file or directory, access '/var/www/Activity/src/main/resources/templates/Christmas/node_modules/abab
npm ERR! enoent This is related to pm not being able to find a file. npm ERR! enoent
阅读 3.6k
4 个回答

权限问题,没有赋予 npm 对改目录的写入权限

sudo一下就是啦

话说这么明显的提示也需要在这里提问?

你这个是没有权限写,npm时在前边加上sudo就行了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题