kdchang / reactjs101

從零開始學 ReactJS(ReactJS 101)是一本希望讓初學者一看就懂的 React 中文入門教學書,由淺入深學習 ReactJS 生態系 (Flux, Redux, React Router, ImmutableJS, React Native, Relay/GraphQL etc.)。
https://www.gitbook.com/book/kdchang/react101/details
Other
4.31k stars 1.22k forks source link

npm run dev 失敗 #103

Open Malarkey-Jhu opened 6 years ago

Malarkey-Jhu commented 6 years ago

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! reactjs-101@1.0.0 dev: webpack-dev-server --devtool eval --progress --colors --content-base build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactjs-101@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

mike1026915 commented 6 years ago

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

Dulmcat commented 5 years ago

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