Cannot find module 'webpack'

简介: Cannot find module 'webpack'

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跟踪的所有文件和目录被删除。

相关文章
|
4月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
91 0
|
5月前
|
JavaScript
Vue 开发中的一些问题简单记录,Cannot find module ‘webpack/lib/RuleSet‘
Vue 开发中的一些问题简单记录,Cannot find module ‘webpack/lib/RuleSet‘
374 1
|
7月前
webpack版本问题 Cannot read property ‘createHash‘ of undefined
webpack版本问题 Cannot read property ‘createHash‘ of undefined
101 1
【Webpack】TypeError: Cannot read property ‘tap‘ of undefined at HtmlWebpackPlugin.
【Webpack】TypeError: Cannot read property ‘tap‘ of undefined at HtmlWebpackPlugin.
Webpack打包出错:Error: Cannot find module ‘webpack/lib/node/NodeTemplatePlugin‘ Require stack:
Webpack打包出错:Error: Cannot find module ‘webpack/lib/node/NodeTemplatePlugin‘ Require stack:
Error: Cannot find module ‘webpack‘ 问题解决办法
Error: Cannot find module ‘webpack‘ 问题解决办法
837 1
|
前端开发 JavaScript 编译器
【前端异常】vscode:无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称,Cannot find module ”webpack“
【前端异常】vscode:无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称,Cannot find module ”webpack“
1137 0
|
JavaScript Cloud Native Go
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
84 0
|
资源调度 前端开发 JavaScript
【微前端】手把手教你从0到1实现基于Webpack5 模块联邦(Module Federation)的微前端~(下)
【微前端】手把手教你从0到1实现基于Webpack5 模块联邦(Module Federation)的微前端~(下)
|
缓存 资源调度 前端开发
【微前端】手把手教你从0到1实现基于Webpack5 模块联邦(Module Federation)的微前端~(中)
【微前端】手把手教你从0到1实现基于Webpack5 模块联邦(Module Federation)的微前端~(中)