2017-08-04 23 views
0

npmを開始するとこのエラーが発生します。 私は、ノードモジュールを削除し、あなたはそれがES6コードを(反応)transpilesので、プロジェクトにバベルのパッケージを追加する必要が反応開始npm開始

  1. ERROR in multi (webpack)-dev-server/client? http://localhost:8080 ./main.js
  2. Module not found: Error: Can't resolve 'babel' in '*****'

  3. @ multi (webpack)-dev-server/client? http://localhost:8080 ./main.js

  4. webpack: Failed to compile

This is my webpack.config 
    module.exports = { 
     entry : './main.js', 
     output: { 
      path: '/', 
      filename: 'index.js' 
     }, 
    devServer: { 
     inline: true, 
     port: 8083 
    }, 
    module: { 
     loaders: [ 
      { 
       test: /\.js$/, 
       exclude: /node_modules/, 
       loader: 'babel', 
       query: { 
        presets: ['es2015','react'] 
       } 
      } 
     ] 
    } 
    } 

This is my package.json 
    { 
     "name": "proj3", 
     "version": "1.0.0", 
     "description": "", 
     "main": "index.js", 
     "scripts": { 
     "start": "webpack-dev-server" 
     }, 
     "author": "", 
     "license": "ISC", 
     "dependencies": { 
     "react": "^15.6.1", 
     "react-dom": "^15.6.1" 
     }, 
     "devDependencies": { 
     "webpack": "^3.4.1", 
     "webpack-dev-server": "^2.6.1" 
     } 
    } 
+0

「反応 - スリングショット」または「作成 - 反応 - アプリケーション」(https://github.com/facebookincubator/create-react-app)のようなものを使用してください。最終的には多くの時間と頭痛を軽減しますので、ツールを設定する代わりに開発に集中することができます。 – Denialos

答えて

1

を再インストールしたがへこみの修正問題NPMやってみました。

これはパッケージです。

babel-loader 
babel-core 
babel-preset-es2015 
babel-preset-react 
+0

uplを追加する方法を表示できます – user8281502

+0

npm install --save babel-loader babel-core babel-preset-es2015 babel-preset-react –

関連する問題