vijay_flexcee
vijay_flexcee

Reputation: 23

Unable to run "npm start" shows error. how to resolve?

Getting error while running comment "npm start" in windows 10.

showing error

Package.json

Packages.json

Log

webpack.config.js

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: ['es2015', 'react']
            }
         }
      ]
   }
}

Upvotes: 2

Views: 23796

Answers (2)

Siddharth Borderwala
Siddharth Borderwala

Reputation: 51

There is a problem with your webpack.config.js file. You need to export the config object like this-

module.exports = {
   entry: './main.js',

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

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

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

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

Upvotes: 0

Jens Alenius
Jens Alenius

Reputation: 1931

Try typing npm run start alt npm r start

navigate to the same folder where the package.json is located type npm install to get all the dependencies. type npm run start

Do you have the webpack.config.js?

Could be malformed webpack config: This is how mine looks, (replace with your stuff):

var path = require('path');

module.exports = {
    context: path.resolve('src/main'),
    entry: {
        myapp: './dependencies.js',
    },
    output: {
        path: path.resolve('build/dev'),
        filename: '[name].js'
    },
    module: {
        loaders: [
            {
                test: /.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf)(.*)$/,
                loader: 'url-loader?limit=100000'
            },
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            }
        ]
    }

};

Upvotes: 0

Related Questions