extract-text-webpack-plugin错误npm install

时间:2017-04-27 21:48:34

标签: css npm webpack

尝试安装extract-text-webpack-pluginpm install

时出错
extract-text-webpack-plugin --save-devapp@0.1.0 /home/g/learn/web-app/ema/src/main/app
├─┬ extract-text-webpack-plugin@2.1.0 
│ ├── async@2.3.0 
│ └── loader-utils@1.1.0 
└── UNMET PEER DEPENDENCY webpack@^2.2.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.17 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN extract-text-webpack-plugin@2.1.0 requires a peer of webpack@^2.2.0 but none was installed.

还试过这个:

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

不工作。

2 个答案:

答案 0 :(得分:0)

看起来你试图为webpack2安装extract-text-webpack-plugin( UNMET PEER DEPENDENCY webpack@^2.2.0

但是你已经安装了webpack1,所以你应该使用webpack 1的提取插件

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

答案 1 :(得分:0)

这些都是警告,而不是错误。这意味着该软件包已成功安装,但您可能需要另一个软件包才能使其正常运行。请参阅npm - peerDependencies

您可以安全地忽略fsevents警告。它是一个专门用于macOS的程序包,用于监视其文件系统的更改。

另一方面,您需要解决未满足的对等关系webpack。最新版本的extract-text-webpack-plugin取决于webpack 2(v2.2.0是webpack 2的第一个正式版本)。你可能正在使用webpack 1,你有两个选择来解决这个问题。您可以安装webpack 2,此时建议使用。您可能需要稍微更改配置。请查看官方Migration Guide,了解您需要更改的内容。

npm install webpack@latest --save-dev

如果您不能或不想升级到webpack 2,则可以使用与webpack 1一起使用的旧版extract-text-webpack-plugin

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