vue项目报错“Cannot find module ”的解决办法

报错信息举例:

> node build/dev-server.js

module.js:491
throw err;
^

Error: Cannot find module ‘content-disposition’
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/bkd/workspace/vue/vue-test1/node_modules/_express@4.15.4@express/lib/utils.js:15:26)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-test1@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-test1@1.0.0 dev 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:

 

解决办法:

进入项目的所在的目录,删除node_modules目录下的所有文件即可。

Author: bkdwei