Webpack安装webpack@3.5.5需要

时间:2017-08-21 09:05:45

标签: node.js linux ubuntu node-modules

我一直在尝试在Ubuntu和Debian上安装webpack时出现问题我在执行“npm install -g webpack”时遇到以下错误 “。我做过更新和升级,我在debian之间交换了操作系统,现在卡在了Ubuntu上。现在很困惑。

  WARN engine webpack@3.5.5: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (current:                               {"node":"4.2.6","npm":"3.5.2"})
  WARN engine webpack@3.5.5: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (current:                              loadDep:yargs → headers   ▐ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
  WARN engine loader-runner@2.3.0: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (cu                              loadDep:yargs → resolveWi ▄ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
  WARN engine enhanced-resolve@3.4.1: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"}                               (current: {"node":"4.2.6","npm":"3.5.2"})
  WARN engine uglifyjs-webpack-plugin@0.4.6: wanted: {"node":">=4.3.0 <5.0.0 || >=                              /usr/local/bin/webpack -> /usr/local/lib/node_modules/webpack/bin/webpack.js

 > uglifyjs-webpack-plugin@0.4.6 postinstall /usr/local/lib/node_modules/webpack/                              node_modules/uglifyjs-webpack-plugin
 > node lib/post_install.js

 sh: 1: node: not found
 /usr/local/lib
 └── (empty)

 npm WARN optional Skipping failed optional dependency /webpack/chokidar/fsevents                              :
 npm WARN notsup Not compatible with your operating system or architecture: fseve                              nts@1.1.2
 npm ERR! Linux 2.6.32-042stab123.9
 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "webpack"
 npm ERR! node v4.2.6
 npm ERR! npm  v3.5.2
 npm ERR! file sh
 npm ERR! code ELIFECYCLE
 npm ERR! errno ENOENT
 npm ERR! syscall spawn

 npm ERR! uglifyjs-webpack-plugin@0.4.6 postinstall: `node    lib/post_install.js`
 npm ERR! spawn ENOENT
 npm ERR!
 npm ERR! Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall script   'node li                              b/post_install.js'.
 npm ERR! Make sure you have the latest version of node.js and npm    installed.
 npm ERR! If you do, this is most likely a problem with the uglifyjs-  webpack-plug                              in package,
 npm ERR! not with npm itself.
 npm ERR! Tell the author that this fails on your system:
 npm ERR!     node lib/post_install.js
 npm ERR! You can get information on how to open an issue for this project with:
 npm ERR!     npm bugs uglifyjs-webpack-plugin
 npm ERR! Or if that isn't available, you can get their info via:
 npm ERR!     npm owner ls uglifyjs-webpack-plugin
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with any support request:
 npm ERR!     /root/npm-debug.log
 npm ERR! code 1

1 个答案:

答案 0 :(得分:2)

您正在使用4.3以下的节点版本4.2.6。 Webpack需要4.3以上的节点版本

如果可能,请更新您的节点版本。

$ sudo apt-get install curl
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash –
$ sudo apt-get install -y nodejs

或使用n npm库。