我需要将Express Web应用程序的源代码(文件夹)移动到Windows 7 OS上的其他目录(同一驱动器)中。
我将整个文件夹复制到目标目录。但是,当我在命令提示符窗口中从新项目目录中退出npm start
时,它失败了。
> node ./bin/www
module.js:549
throw err;
^
Error: Cannot find module 'node-fetch'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Work\Support Craig B\Equipment App\express-parse-equipment-app\routes\users.js:5:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-parse-equipment-app@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the express-parse-equipment-app@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\chena\AppData\Roaming\npm-cache\_logs\2018-08-18T12_41_04_928Z-debug.log
此错误项目是否特定,或者,不是,移动Express项目源文件夹的最佳实践是什么?
答案 0 :(得分:0)
尝试先运行npm prune
,然后再运行npm install
。
如果仍然不起作用,则可能是npm缓存问题。尝试删除缓存:rm -rf ~/.npm
,然后再次运行npm install
。