使用npm在全局安装webpack

时间:2016-12-01 18:05:20

标签: javascript node.js npm

我对节点环境并不熟悉。我在我的OSX机器上运行了这个

sudo npm install -g webpack

它在那里成功安装,并在控制台上输出

/usr/local/bin/webpack -> /usr/local/lib/node_modules/webpack/bin/webpack.js

但是当我在grunt文件中运行需要require('webpack');的{​​{1}}命令时,我收到此消息

grunt.js

然后我尝试关注一些Loading "Gruntfile.js" tasks...ERROR >> Error: Cannot find module 'webpack' Warning: Task "default" not found. Use --force to continue. 帖子并运行SO。但是,然后运行npm install会给我一些与gruntreact等相关的错误...

顺便说一下,当我第一次发布命令react-dom时,我收到了这些警告

npm install

更新:

这是npm WARN react-dom@15.4.1 requires a peer of react@^15.4.1 but none was installed. npm WARN react-select@1.0.0-beta5 requires a peer of react@^0.14.1 but none was installed. npm WARN react-select@1.0.0-beta5 requires a peer of react-dom@^0.14.1 but none was installed. npm WARN react-input-autosize@0.6.13 requires a peer of react@^0.14 || ^15.0.0-rc || ^15.0 but none was installed. npm WARN grunt-webpack@1.0.18 requires a peer of webpack@1.x but none was installed. npm WARN webpack-dev-server@1.16.2 requires a peer of webpack@>=1.3.0 <3 but none was installed. npm WARN webpack-dev-middleware@1.8.4 requires a peer of webpack@1 || ^2.1.0-beta but none was installed. npm WARN mapapp@1.8.0 No repository field. npm WARN mapapp@1.8.0 No license field. 文件的内容

webpack.config.js

0 个答案:

没有答案