npm run dev 出错的解决办法
bogon:~ yan$ cd my-project
bogon:my-project yan$ npm run dev
> my-project@1.0.0 dev /Users/yan/my-project
> node build/dev-server.js
module.js:471
throw err;
^
Error: Cannot find module \’shelljs\’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/yan/my-project/build/check-versions.js:4:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
ERR! code ELIFECYCLE
errno 1
ERR! my-project@1.0.0 dev: `node build/dev-server.js`
ERR! Exit status 1
ERR! Failed at the my-project@1.0.0 dev script.
ERR! This is probably not a problem with npm. There is likely additional logging output above.
ERR! A complete log of this run can be found in:
ERR! /Users/yan/.npm/_logs/2017-09-13T09_56_03_996Z-debug.log
bogon:my-project yan$ npm install shelljs
notice created a lockfile as package-lock.json. You should commit this file.
+ shelljs@0.7.8
added 16 packages in 32.151s
解决办法:error提示缺少什么模块就 npm install XXX ,缺少什么模块就运行安装命令;
bogon:my-project yan$ npm run dev
> my-project@1.0.0 dev /Users/yan/my-project
> node build/dev-server.js
> Starting dev server…
直到启动dev成功;