Cannot find module 'webpack'
程序员文章站
2022-06-01 12:45:25
...
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! [email protected] dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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跟踪的所有文件和目录被删除。
推荐阅读
-
webpack-dev-server config.js Cannot find module
-
NetBeans安装提示neatbeans cannot find java 1.8 or higher
-
编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法
-
Linux系统中提示/usr/bin/ld: cannot find -lxxx错误的通用解决方法
-
ASP.NET The system cannot find the file specified解决办法
-
编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法
-
webpack-dev-server config.js Cannot find module
-
PHP动态编译出现Cannot find autoconf的解决方法
-
CENTOS7错误:Cannot find a valid baseurl for repo: base/7/x86_6
-
Linux安装Apache报错:Cannot find a valid baseurl for repo: base/7/x86_64解决方案