当我运行“npm run watch”时,我收到此错误,这是什么意思,我该如何解决?

时间:2018-05-26 19:30:44

标签: reactjs npm

> crafty@1.0.0 watch /Users/sirishasamudrala/Desktop/crafty
> webpack --progress -d --config webpack.config.js --watch

/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:243
                                throw err;
                                ^
  

错误:无法找到模块'extract-text-webpack-plugin'           在Function.Module._resolveFilename(module.js:555:15)           在Function.Module._load(module.js:482:25)           在Module.require(module.js:604:17)           at require(/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)           在对象。 (/Users/sirishasamudrala/Desktop/crafty/webpack.config.js:2:25)           在Module._compile(/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)           at Object.Module._extensions..js(module.js:671:10)           在Module.load(module.js:573:32)           在tryModuleLoad(module.js:513:12)           在Function.Module._load(module.js:505:3)           在Module.require(module.js:604:17)           at require(/Users/sirishasamudrala/Desktop/crafty/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)           在WEBPACK_OPTIONS(/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:133:13)           at requireConfig(/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:135:6)           at /Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:142:17           在Array.forEach()           在module.exports(/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/convert-argv.js:140:15)           在yargs.parse(/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:240:39)           在Object.parse(/Users/sirishasamudrala/Desktop/crafty/node_modules/yargs/yargs.js:552:18)           at /Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:218:8           在对象。 (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack-cli/bin/webpack.js:515:3)           在Module._compile(module.js:660:30)           at Object.Module._extensions..js(module.js:671:10)           在Module.load(module.js:573:32)           在tryModuleLoad(module.js:513:12)           在Function.Module._load(module.js:505:3)           在Module.require(module.js:604:17)           at require(internal / module.js:11:18)           在对象。 (/Users/sirishasamudrala/Desktop/crafty/node_modules/webpack/bin/webpack.js:80:2)           在Module._compile(module.js:660:30)   错误的ERR!代码ELIFECYCLE   错误的ERR!错误1   错误的ERR! crafty@1.0.0观看:webpack --progress -d --config webpack.config.js --watch   错误的ERR!退出状态1   错误的ERR!   错误的ERR!在crafty@1.0.0监视脚本失败.npm ERR!这可能不是npm的问题。上面可能有额外的日志记录输出。

     

npm ERR!可以在以下位置找到此运行的完整日志:   错误的ERR! /Users/sirishasamudrala/.npm/_logs/2018-05-26T19_22_18_720Z-debug.log

1 个答案:

答案 0 :(得分:1)

这意味着您的项目未安装extract-text-webpack-plugin

运行

npm i extract-text-webpack-plugin -D

或者

手动将其添加到package.json并运行npm i

当您将粘贴代码复制到webpack配置中并忘记更新依赖项时,通常会发生这种情况。

对所有缺失的模块执行相同操作。