Webpack-extract-text-webpack-plugin找不到模块

webpack.config.js

var ExtractTextPlugin = require("extract-text-webpack-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)

我忘了什么?

猴子Eva2020/03/24 09:57:06

跑步npm i node-sass可能会解决您的问题

达蒙2020/03/24 09:57:06

使用$ npm i -D extract-text-webpack-plugin@next,这将解决您的问题

让我知道这是否有效。

https://github.com/webpack/webpack/issues/6568

Stafan2020/03/24 09:57:06

您可以尝试在https://www.npmjs.com/package/extract-text-webpack-plugin上找到的此命令

npm i extract-text-webpack-plugin
小宇宙2020/03/24 09:57:06

简单修复

npm install extract-text-webpack-plugin --save-dev

https://www.npmjs.com/package/extract-text-webpack-plugin

JimAGil2020/03/24 09:57:06

用使用解决

npm install extract-text-webpack-plugin --save-dev

GO村村2020/03/24 09:57:06

webpack您的项目中模块吗?
如果不是,请在本地安装(不是全局安装):

$ npm install webpack [--save-dev]

extract-text-webpack-plugin需要webpack作为对等方依赖项,但是npm 3不会自动安装对等方依赖项。