###前提・実現したいこと
npm run start
としてwebpack-dev-serverを起動させると、
なぜかローカルサーバーが2つ起動し、下記のような警告が大量に表示されます。
原因は何なのでしょうか。
Project is running at http://localhost:8080/ webpack output is served from / Project is running at http://localhost:8081/ webpack output is served from / /* 中略 */ WARNING in (webpack)-dev-server/client/socket.js There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. Use equal casing. Compare these module identifiers: * C:\Users\hoge\work_space\redux-button\node_modules\webpack-dev-server\client\socket.js Used by 1 module(s), i. e. C:\Users\hoge\work_space\redux-button\node_modules\webpack-dev-server\client\index.js?http://localhost:8081 * C:\users\hoge\work_space\redux-button\node_modules\webpack-dev-server\client\socket.js Used by 1 module(s), i. e. C:\users\hoge\work_space\redux-button\node_modules\webpack-dev-server\client\index.js?http://localhost:8080 /* 以下同じような警告 */
webpack.config.js
, pacage.json
は下記のようにしています。
webpack.config.js
1var path = require('path'); 2var webpack = require('webpack'); 3 4module.exports = { 5 entry: './src/index.jsx', 6 output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js' }, 7 module: { 8 loaders: [ 9 { 10 test: /.jsx?$/, 11 loader: 'babel-loader', 12 exclude: /node_modules/, 13 query: { 14 presets: ['es2015', 'react'] 15 } 16 } 17 ] 18 }, 19 devtool: 'source-map' 20} 21
package.json
1{ 2 "name": "react_test", 3 "version": "1.0.0", 4 "description": "", 5 "main": "index.js", 6 "scripts": { 7 "start": "./node_modules/.bin/webpack-dev-server" 8 }, 9 "keywords": [], 10 "author": "", 11 "license": "ISC", 12 "dependencies": { 13 "react": "^15.5.4", 14 "react-dom": "^15.5.4", 15 "redux": "^3.6.0" 16 }, 17 "devDependencies": { 18 "babel-core": "^6.24.1", 19 "babel-loader": "^7.0.0", 20 "babel-preset-es2015": "^6.24.1", 21 "babel-preset-react": "^6.24.1", 22 "react-redux": "^5.0.5", 23 "webpack": "^2.4.1", 24 "webpack-dev-server": "^2.4.5" 25 } 26} 27
ちなみに、./node_modules/.bin/webpack-dev-server
と直接コマンドを実行すると正常に起動します。
npm run start
としたときだけローカルサーバーが2つ起動し警告が表示されます。
何かご回答を頂けると助かります_(..)
###補足情報(言語/FW/ツール等のバージョンなど)
最近PCを交換し、Nodist経由でNode.jsとnpmをインストールしています。
環境変数は設定されています。
Windows10 Pro
Nodist > 0.8.8
Node.js > 6.11.4
npm > 5.4.2
###追記
package.json
に下記を加えてwebpack単体では動作するか確認したところ問題なく動作しました。
js:package.json
1"scripts": { 2+ "build": "webpack", 3 "start": "./node_modules/.bin/webpack-dev-server" 4 }, 5
###追記2
Git Bashを使用しているのですが、
Git Bashからnpm run start
とすると上記のような警告が表示され、
コマンドプロンプトからnpm run start
とすると正常にwebpack-dev-serverが起動するようです。
回答1件
あなたの回答
tips
プレビュー