npm run dev 失敗

2
open
Malarkey-Jhu
Malarkey-Jhu
Posted 3 years ago

npm run dev 失敗 #103

scripts 中已經添加這行: "dev": "webpack-dev-server --devtool eval --progress --colors --content-base build",

但terminal還是顯示錯誤,好像是要叫我裝webpack 但按照他給我的提示npm install webpack-cli -D 之後還是出錯

以下是報錯信息,有人知道怎麼解決嗎

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 module.js:549 throw err; ^

Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/Users/alan_pc/Desktop/ReactTraining/reactjs-101/node_modules/webpack-dev-server/bin/webpack-dev-server.js:65:1) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dev: webpack-dev-server --devtool eval --progress --colors --content-base build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

mike1026915
mike1026915
Created 3 years ago

請問是不是裝新版的babel webpack之後 這些方法都無效了?

Dulmcat
Dulmcat
Created 2 years ago

教程需要更新了,按照教程安装的都会报错,这一章暂且跳过了