npm run dev,报错,昨天还运行好好的,然后执行了 git clean xfd, 然后本地无法启动
> node build/dev-server.js internal/modules/cjs/loader.js:651 throw err; ^ Error: Cannot find module 'webpack' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15) at Function.Module._load (internal/modules/cjs/loader.js:575:25) at Module.require (internal/modules/cjs/loader.js:705:19) at require (internal/modules/cjs/helpers.js:14:16) at Object.<anonymous> (/Users/jiang/Documents/2019/项目/探索中心/code/bdcsc2x-portal-backend-page/build/dev-server.js:1:15) at Module._compile (internal/modules/cjs/loader.js:799:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10) at Module.load (internal/modules/cjs/loader.js:666:32) at tryModuleLoad (internal/modules/cjs/loader.js:606:12) at Function.Module._load (internal/modules/cjs/loader.js:598:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! meeting-visl-page@1.0.0 dev: `node build/dev-server.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the meeting-visl-page@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install? npm ERR! A complete log of this run can be found in: npm ERR! /Users/jiang/.npm/_logs/2019-10-15T02_48_55_006Z-debug.log
解决方法:
1、首先我打开其他项目,是可以直接运行的
2、然后我本地yarn,重新安装了下包,然后就可以了。
3、git clean xfd(命令慎用),导致git目录下未被git跟踪的所有文件和目录被删除。