Sunday 14 May 2017

How to set up react and nodeJS on your local machine(npm error)?

I'm new in React and nodeJS and I have some problems with webpack and npm. I've tried to configure my localhost based on this tutorial : https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm

When I write into the cmd: "npm start" it throws me the following message(on the picture). I've installed webpack but it says it doesn't recognise it. And what is a "weird error" by the way? Can you give me some links, where I can properly config my machine? enter image description here My webpack.config.js file:

 var config = {
   entry: './main.js',

   output: {
    path:'./',
    filename: 'index.js',
    },

   devServer: {
     inline: true,
     port: 8080
   },

   module: {
     loaders: [
       {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',

        query: {
           presets: ['es2016', 'react']
        }
     }
    ]
   }
  }

  module.exports = config;

package.json file:

   {
    "name": "reactApp",
    "version": "0.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "start": "webpack-dev-server --hot"
    },
    "author": "",
    "license": "BSD"
   }



via JustMatthew

No comments:

Post a Comment