在我的node_modules上安装新软件包时,出现以下错误:
npm install --save [package]
npm ERR! path /home/user/Dev/application-name-example/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/user/Dev/application-name-example/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates' -> '/home/user/Dev/application-name-example/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/.delegates.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! /home/user/.npm/_logs/2017-08-28T11_02_39_419Z-debug.log
它无法重命名的特定文件在一些常见的违规者中有所不同,但它始终是重命名问题。我可以用rm -rf node_modules
解决这个问题,但每次都不能做到这一点,这不是一个理想的解决方案。
我见过的类似问题建议这样做: npm: ENOENT: no such file or directory
这只发生在一个新项目上,并没有发生在旧项目上,有谁知道为什么?它与path-length或package.json配置有关吗?