npm ERR! enoent ENOENT: no such file or directory

最近在Clone一个vue项目,在npm install的时候报错npm ERR! enoent ENOENT: no such file or directory

npm ERR! path /Users/my-project/node_modules/.staging/node-sass-b0319c19/node_modules/ansi-styles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/my-project/node_modules/.staging/node-sass-b0319c19/node_modules/ansi-styles' -> '/Users/my-project/node_modules/.staging/ansi-styles-a703b626'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

首先想到的是文件夹有权限,但是我已经赋与了777权限,还是报相同的错误,再看这是node-sass部分报错,我再尝试先安装node-sass, 再执行npm install.

$sudo chmod -R 777 文件夹名
$ npm i node-sass save-dev
$ npm i

ok, 执行正确。

发表评论

电子邮件地址不会被公开。 必填项已用*标注