[英]Webpack - extract-text-webpack-plugin Cannot find module
webpack.config.js webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin");
I immediately receive this error if I just implement the plugin:如果我只是实现插件,我会立即收到此错误:
module.js:339
throw err;
^
Error: Cannot find module 'webpack/lib/ConcatSource'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/lucamormile/Documents/Lavori/Webapps/React/webpack_test/node_modules/extract-text-webpack-plugin/index.js:5:20)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
What did i forgot?我忘记了什么?
Do you have webpack
module on your project?你的项目中有webpack
模块吗?
If not, install it locally (not globally):如果没有,请在本地安装(不是全局安装):
$ npm install webpack [--save-dev]
extract-text-webpack-plugin
needs webpack
as peer dependency, but npm 3 doesn't install peer dependencies automatically. extract-text-webpack-plugin
需要webpack
作为对等依赖,但 npm 3 不会自动安装对等依赖。
你可以试试我在https://www.npmjs.com/package/extract-text-webpack-plugin 上找到的这个命令
npm i extract-text-webpack-plugin
我通过使用解决它
npm install extract-text-webpack-plugin --save-dev
Use $ npm i -D extract-text-webpack-plugin@next
and this would solve your issue使用$ npm i -D extract-text-webpack-plugin@next
这将解决您的问题
Let me know if this worked.让我知道这是否有效。
https://github.com/webpack/webpack/issues/6568 https://github.com/webpack/webpack/issues/6568
webpack.config.js webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin");
I immediately receive this error if I just implement the plugin:如果我只是实现插件,我会立即收到此错误:
module.js:339
throw err;
^
Error: Cannot find module 'webpack/lib/ConcatSource'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/lucamormile/Documents/Lavori/Webapps/React/webpack_test/node_modules/extract-text-webpack-plugin/index.js:5:20)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
What did i forgot?我忘了什么?
运行npm i node-sass
可能会解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.