npm start
webpack のインストール後に実行すると、react プロジェクトでエラーが発生します。
npm install webpack
npm install webpack-dev-server
これは私のpackage.jsonです(上記のパッケージなし)
{
"name": "myproject",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.9.3"
},
"dependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-router": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
webpack と webpack-dev-server をインストールするとすぐに、このエラーが発生し始めますnpm start
Failed to compile.
Error in TypeError: Cannot read property '0' of undefined
- ExternalModuleFactoryPlugin.js:19
[myproject]/[webpack]/lib/ExternalModuleFactoryPlugin.js:19:40
- NormalModuleFactory.js:159
[myproject]/[react-scripts]/[webpack]/lib/NormalModuleFactory.js:159:3
- Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
[myproject]/[react-scripts]/[tapable]/lib/Tapable.js:75:69
- NormalModuleFactory.js:144 NormalModuleFactory.create
[myproject]/[react-scripts]/[webpack]/lib/NormalModuleFactory.js:144:8
- Compilation.js:356 Compilation.process [as _addModuleChain]
[myproject]/[react-scripts]/[webpack]/lib/Compilation.js:356:16
- Compilation.js:424 Compilation.process [as addEntry]
[myproject]/[react-scripts]/[webpack]/lib/Compilation.js:424:7
- SingleEntryPlugin.js:24 Compiler.<anonymous>
[myproject]/[webpack]/lib/SingleEntryPlugin.js:24:16
- Tapable.js:107 Compiler.applyPluginsParallel
[myproject]/[react-scripts]/[tapable]/lib/Tapable.js:107:14
- Compiler.js:394 Compiler.compile
[myproject]/[react-scripts]/[webpack]/lib/Compiler.js:394:7
- Compiler.js:203 Compiler.runAsChild
[myproject]/[react-scripts]/[webpack]/lib/Compiler.js:203:7
- compiler.js:70
[myproject]/[html-webpack-plugin]/lib/compiler.js:70:19
- compiler.js:69 Object.compileTemplate
[myproject]/[html-webpack-plugin]/lib/compiler.js:69:10
これが私のnpmバージョンです。
$ npm -v
4.5.0
これは私のコードと関係がありますか、それとも npm/react-scripts の問題ですか?