1. 程式人生 > >解決: 執行npm run webpack命令報錯問題

解決: 執行npm run webpack命令報錯問題

解決: 執行npm run webpack報錯

問題描述:

MacBook-Pro:webpack-demo $ npm run-script webpack
[email protected] webpack /Users/aaaaaaa/webpack/webpack-demo
webpack
The CLI moved into a separate package: webpack-cli.
Please install ‘webpack-cli’ in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
npm ERR! Darwin 17.2.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run-script” “webpack”
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR!

[email protected] webpack: webpack
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] webpack script ‘webpack’.
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 webpack-demo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webpack-demo
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls webpack-demo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/aaa/webpack/webpack-demo/npm-debug.log
這裡寫圖片描述

解決方法: webpack 替換為 webpack-cli 問題解決
這裡寫圖片描述