Ошибка при npm start

Getting error while running comment «npm start» in windows 10.

showing error

Package.json

Packages.json

Log
  • 0 info it worked if it ends with ok
  • 1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
  • 1 verbose cli ‘C:\Users\vkarutha\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’,
  • 1 verbose cli ‘start’ ]
  • 2 info using npm@4.2.0
  • 3 info using node@v6.9.3
  • 4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
  • 5 info lifecycle hello-world@0.1.0~prestart: hello-world@0.1.0
  • 6 silly lifecycle hello-world@0.1.0~prestart: no script for prestart, continuing
  • 7 info lifecycle hello-world@0.1.0~start: hello-world@0.1.0
  • 8 verbose lifecycle hello-world@0.1.0~start: unsafe-perm in lifecycle true
  • 9 verbose lifecycle hello-world@0.1.0~start: PATH: C:\Users\vkarutha\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\vkarutha\Documents\React\hello-world\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files (x86)\Cisco\OSD-ShellApplications;C:\Program Files\Java\jdk1.8.0_101\bin;C:\Cisco\software\apache-maven-3.3.9\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\nodejs\bin;C:\Program Files (x86)\Sennheiser\SoftphoneSDK\;C:\Program Files (x86)\ssh communications security\ssh Secure Shell;C:\Users\vkarutha\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\nodejs\bin
  • 10 verbose lifecycle hello-world@0.1.0~start: CWD: C:\Users\vkarutha\Documents\React\hello-world
  • 11 silly lifecycle hello-world@0.1.0~start: Args: [ ‘/d /s /c’, ‘webpack-dev-server —hot’ ]
  • 12 silly lifecycle hello-world@0.1.0~start: Returned: code: 4294967295 signal: null
  • 13 info lifecycle hello-world@0.1.0~start: Failed to exec start script
  • 14 verbose stack Error: hello-world@0.1.0 start: webpack-dev-server --hot
  • 14 verbose stack Exit status 4294967295
  • 14 verbose stack at EventEmitter. (C:\Users\vkarutha\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
  • 14 verbose stack at emitTwo (events.js:106:13)
  • 14 verbose stack at EventEmitter.emit (events.js:191:7)
  • 14 verbose stack at ChildProcess. (C:\Users\vkarutha\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
  • 14 verbose stack at emitTwo (events.js:106:13)
  • 14 verbose stack at ChildProcess.emit (events.js:191:7)
  • 14 verbose stack at maybeClose (internal/child_process.js:877:16)
  • 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  • 15 verbose pkgid hello-world@0.1.0
  • 16 verbose cwd C:\Users\vkarutha\Documents\React\hello-world
  • 17 error Windows_NT 10.0.10586
  • 18 error argv «C:\Program Files\nodejs\node.exe» «C:\Users\vkarutha\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js» «start»
  • 19 error node v6.9.3
  • 20 error npm v4.2.0
  • 21 error code ELIFECYCLE
  • 22 error errno 4294967295
  • 23 error hello-world@0.1.0 start: webpack-dev-server --hot
  • 23 error Exit status 4294967295
  • 24 error Failed at the hello-world@0.1.0 start script ‘webpack-dev-server —hot’.
  • 24 error Make sure you have the latest version of node.js and npm installed.
  • 24 error If you do, this is most likely a problem with the hello-world package,
  • 24 error not with npm itself.
  • 24 error Tell the author that this fails on your system:
  • 24 error webpack-dev-server —hot
  • 24 error You can get information on how to open an issue for this project with:
  • 24 error npm bugs hello-world
  • 24 error Or if that isn’t available, you can get their info via:
  • 24 error npm owner ls hello-world
  • 24 error There is likely additional logging output above.
  • 25 verbose exit [ 4294967295, true ]

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']
            }
         }
      ]
   }
}

asked Feb 15, 2017 at 9:19

vijay_flexcee's user avatar

vijay_flexceevijay_flexcee

231 gold badge1 silver badge7 bronze badges

1

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'
            }
        ]
    }

};

answered Feb 15, 2017 at 9:23

Jens Alenius's user avatar

Jens AleniusJens Alenius

1,9312 gold badges16 silver badges20 bronze badges

6

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']
            }
         }
      ]
   }
}

answered Jan 19, 2021 at 7:17

Siddharth Borderwala's user avatar

I’m receiving this error when trying to debug my node application using the npm start command.

Error:

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\andrmoll.NORTHAMERICA\Documents\GitHub\SVIChallenge\npm-debug.log

From the debug file:

Error: missing script: start
       at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
       at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
       at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
       at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
       at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:300:12
       at evalmachine.<anonymous>:334:14
       at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:102:5
       at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)

BinaryButterfly's user avatar

asked Aug 12, 2015 at 22:51

Andrew Moll's user avatar

1

It looks like you might not have defined a start script in your package.json file or your project does not contain a server.js file.

If there is a server.js file in the root of your package, then npm will default the start command to node server.js.

https://docs.npmjs.com/misc/scripts#default-values

You could either change the name of your application script to server.js or add the following to your package.json

"scripts": {
    "start": "node your-script.js"
}

Or … you could just run node your-script.js directly

answered Aug 12, 2015 at 23:04

Robbie's user avatar

RobbieRobbie

18.8k4 gold badges41 silver badges45 bronze badges

9

I had this issue while installing react-js for the first time :
These line helped me solve the issue:

npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app

source: https://stackoverflow.com/a/59260128/11652661

answered May 8, 2020 at 13:27

nofoobar's user avatar

nofoobarnofoobar

2,82620 silver badges24 bronze badges

1

add this inside package.json file before closing the «}»

,"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
}

Taher's user avatar

Taher

11.9k2 gold badges29 silver badges44 bronze badges

answered May 19, 2016 at 8:38

Dima Dorogonov's user avatar

Dima DorogonovDima Dorogonov

2,3151 gold badge21 silver badges23 bronze badges

2

This error also happens if you added a second «scripts» key in the package.json file. If you just leave one «scripts» key in the package.json the error disappears.

answered Jan 20, 2016 at 9:24

Plamen Petkov's user avatar

4

I just stumbled upon this issue. I reinstalled NPM, created a new React app (so basically a clean install) and still no luck.
Finally figured it out:

My terminal was NOT in the correct location.

I had to changedirectory one level deeper into my app.
So my terminal was in my ‘projects‘ folder instead of my ‘my-app‘ folder

Path: ‘/Documents/projects/my-app’

answered Feb 24, 2021 at 19:18

Don H's user avatar

Don HDon H

6597 silver badges9 bronze badges

1

Hope it might help someone.
This error also happens if you didn’t open your project from the root of the project. Make sure to cd into the folder before opening it inside VS code.

answered Jun 29, 2021 at 6:42

LaCodeM's user avatar

LaCodeMLaCodeM

6867 silver badges24 bronze badges

You might have an old (global) installation of npm which causes the issue. As of 12/19, npm does not support global installations.

First, uninstall the package using:
npm uninstall -g create-react-app

Some osx/Linux users may need to also remove the old npm using:
rm -rf /usr/local/bin/create-react-app

This is now the only supported method for generating a project:
npx create-react-app my-app

Finally you can run:
npm start

answered May 16, 2020 at 18:05

Ali's user avatar

AliAli

6643 gold badges13 silver badges21 bronze badges

Try this method it will work for you
Try this Method it will work 100 %

answered Apr 6, 2021 at 9:38

GHULAM NABI's user avatar

GHULAM NABIGHULAM NABI

4945 silver badges15 bronze badges

Please use the below line of code in script object which is there in package.json

"scripts": {
    "start": "webpack-dev-server --hot"
}

For me it worked perfectly fine.

slfan's user avatar

slfan

8,985115 gold badges65 silver badges78 bronze badges

answered Apr 30, 2016 at 13:29

Ray's user avatar

RayRay

2803 silver badges4 bronze badges

1

Try with these steps :

npm rm -g create-react-app

npm install -g create-react-app

npx create-react-app my-app

Definitely this works!!

answered Jul 17, 2020 at 8:15

Srinivasan N's user avatar

I had a similar issue while installing react-js for the first time : These line helped me solve the issue:

npm uninstall -g create-react-app
npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app

this worked in my case.

answered Jun 16, 2021 at 7:19

cherry's user avatar

cherrycherry

3361 gold badge2 silver badges9 bronze badges

1

check package.json file having «scripts» property is there or not. if not update script property like this

{
  "name": "csvjson",
  "version": "1.0.0",
  "description": "upload csv to json and insert it into MongoDB for a single colletion",
  "scripts": {
    "start": "node csvjson.js"
  },
  "dependencies": {
    "csvjson": "^4.3.4",
    "fs": "^0.0.1-security",
    "mongodb": "^2.2.31"
  },
  "devDependencies": {},
  "repository": {
    "type": "git",
    "url": "git+https://github.com/giturl.git"
  },
  "keywords": [
    "csv",
    "json",
    "mongodb",
    "nodejs",
    "collection",
    "import",
    "export"
  ],
  "author": "karthikeyan.a",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/homepage/issues"
  },
  "homepage": "https://github.com/homepage#readme"
}

answered Sep 1, 2017 at 11:03

KARTHIKEYAN.A's user avatar

KARTHIKEYAN.AKARTHIKEYAN.A

18.3k6 gold badges125 silver badges134 bronze badges

If you are using babelify and watchify, go to:

package.json

and add this in «scripts»:

"scripts": {
    "start": "watchify the-path-to-your-source-jsx-file -v -t [ babelify --presets [ react ] ] -o the-path-to-your-output-js-file"
}

An example would be:

"scripts": {
    "start": "watchify src/main.jsx -v -t [ babelify --presets [ react ] ] -o public/js/main.js"
}

Thanks to Mark Price from DevSlopes

SagarPPanchal's user avatar

answered May 12, 2016 at 3:07

epicrato's user avatar

epicratoepicrato

7,5785 gold badges46 silver badges47 bronze badges

In my case, if it’s a react project, you can try to upgrade npm, and then upgrade react-cli

npm -g install npm@version
npm install -g create-react-app

answered Dec 31, 2019 at 3:20

Yream's user avatar

YreamYream

311 bronze badge

0

Installing create-react-app globally is now discouraged. Instead uninstall globally installed create-react-app package by doing: npm uninstall -g create-react-app (you may have to manually delete package folder if this command didn’t work for you. Some users have reported they had to delete folders manually)

Then you can run npx create-react-app my-app to create react app again.

ref: https://github.com/facebook/create-react-app/issues/8086

answered Jan 23, 2020 at 19:40

Muhammad Ashikuzzaman's user avatar

should avoid using unstable npm version.

I observed one thing that is npm version based issue, npm version 4.6.1 is the stable one but 5.x is unstable because package.json will be configured perfectly while creating with default template if it’s a stable version and so we manually don’t need to add that scripts.

I got the below issue on the npm 5 so I downgraded to npm 4.6.1 then its worked for me,


ERROR: npm 5 is not supported yet


It looks like you’re using npm 5 which was recently released.

Create React Native App doesn’t work with npm 5 yet, unfortunately. We
recommend using npm 4 or yarn until some bugs are resolved.

You can follow the known issues with npm 5 at:
https://github.com/npm/npm/issues/16991


Devas-MacBook-Air:SampleTestApp deva$ npm start
npm ERR! missing script: start

answered Jan 28, 2018 at 17:17

Deva's user avatar

DevaDeva

2,3861 gold badge16 silver badges16 bronze badges

0

Another possible reason: you’re using npm when your project is initialized in yarn. (I did this myself). So it would be yarn start instead of npm start.

RobC's user avatar

RobC

23.1k20 gold badges75 silver badges80 bronze badges

answered Aug 23, 2018 at 17:48

kbooth1000's user avatar

I was having the same issues. I was trying to start it at the VS code terminal. So I start the development environment in my computer terminal (not inside the VS Code). It worked. Make sure that you are inside the file in the terminal before you start it

answered May 31, 2021 at 21:53

furkanayilmaz's user avatar

npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app

!important: Make sure you need to chnage the directory to my-app and then hit «npm start»

As you can see in the image , there was an error and it was fixed after chnaging the directory.
enter image description here

answered Jan 22 at 10:16

Sachindra N. Pandey's user avatar

1

Make sure the PORTS ARE ON

var app = express();
app.set('port', (process.env.PORT || 5000));

BLAL BLA BLA AND AT THE END YOU HAVE THIS

app.listen(app.get('port'), function() {
    console.log("Node app is running at localhost:" + app.get('port'))
});

Still a newbee in node js but this caused more of this.

answered Mar 1, 2017 at 12:35

Goodlife's user avatar

GoodlifeGoodlife

3,8222 gold badges24 silver badges23 bronze badges

Take a look at your client/package.json. You have to have these scripts

"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test --env=jsdom",
  "eject": "react-scripts eject"
}

answered Apr 8, 2020 at 10:05

Viktor Poliushko's user avatar

I got this error because I wasn’t in the right directory in terminal.

App with the scripts was in folder B. Folder B was in folder A. I open folder A in vscode and enter «npm run start» into the built in terminal and got the error. try «cd folder B», opening folder B in the ide, or organizing your stuff better than I did in the first place.

answered Jan 14, 2021 at 0:08

thatguy1155's user avatar

I got that same error when I tried run «npm run start»

And my project should starts up with «npm run serve»

If you copy a github project you can look over project setup there like that one:
enter image description here

So always make sure you run it with the right command, in my case was

npm run serve

answered Aug 4, 2021 at 14:34

Juliano Soder's user avatar

1

Check it package.json file out and find your script name in this file

answered Aug 4, 2022 at 7:49

yusufgltc's user avatar

I had this error after create a react project in vscode. After closing and reopening the vscode and create a new terminal in cmd mode in vscode, the problem resolved.

answered Sep 13, 2022 at 7:17

M Komaei's user avatar

M KomaeiM Komaei

7,0702 gold badges28 silver badges34 bronze badges

There are more answers regarding to scripts. Here is my 2 cents. If you having the same issue just after creating the react app or just started the work in the day, in most case this is what happened. You may not got inside of the created project.

Suppose you created a react app as my-app. then you have to go inside of the app before you run nmp start command.

1. cd my-app

2. npm start

It will work fine.

answered Nov 1, 2022 at 12:12

Thishan Dharmakeerthi's user avatar

Check if you have nodemon installed, if you do, run the script using nodemon the start script in your package.json Example nodemon start

answered Nov 24, 2022 at 12:55

Apesin's user avatar

1

Also, do remember to change directory into the exact folder where you server was installed. You will get this error if you run the npm start command from a parent folder of your project.

That was how I got this error.

answered Feb 12 at 9:04

Neil Meyer's user avatar

Neil MeyerNeil Meyer

4734 silver badges15 bronze badges

For my example, I created a React project in «First» folder and I run the project in this folder, so I saw the same error.

You should enter in the project, and then you should run (for my example «react-movies»). You can easily realize if you look at my PowerShell screen.

Enter image description here

Peter Mortensen's user avatar

answered Feb 1 at 21:21

yusuf hayırsever's user avatar

1

The npm start command is to start a JavaScript project or application. Sometimes, you might run into a situation where the npm start command isn’t working as expected.

An example error output is shown below:

$ npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path node-app/package.json
npm ERR! errno -2
npm ERR! enoent 

This can be frustrating, especially if you’re new to JavaScript development and don’t know where to start troubleshooting.

Fortunately, there are three easy steps you can take to fix the npm start command not working:

  1. Create a package.json file in your project
  2. Write the start script in the package.json file
  3. Set the ignore-script config to false

The following tutorial shows how to fix this error in practice

1. Create a package.json file in your project

To run the command, you need to make sure that you have a package.json file in your project.

When you don’t have the package.json file in the current working directory, your console will return a no such file or directory error:

$ npm start
npm ERR! enoent ENOENT: no such file or directory, open '/package.json'

You need to make sure that the package.json file is present from where you run the npm start command.

To do so, run the ls -1 command from the terminal. You should see package.json listed as shown below:

$ ls -1
node_modules
package-lock.json
package.json
server.js
...

When you don’t see the package.json file, then you can create one for your project using the npm init command:

The terminal will require you to fill some information about your project. Once done, a package.json file will be generated for you.

2. Check if the start script is defined

Next, you need to make sure that a start script exists inside the package.json file.

A common start script for most applications is as follows:

{
  "scripts": {
    "start": "node app.js"
  },
}

You need to write node followed by the name of the .js file you want to run as the content of the start script.

If you don’t have a start script as shown above, you might get another error as follows:

$ npm start
npm ERR! Missing script: "start"

This is because while you have a package.json file in your application, the start script is not defined.

The content of the start script may vary, but it must always be located inside the scripts property.

Once you have a start script in your package.json file, the npm start command should work.

3. Set the ignore-script config to false

If you see the start script is present inside your package.json file but npm start still not working, you need to check the console output.

If there’s no output at all, then you may have the ignore-scripts npm configuration set to true.

You can check the configuration by using the command below:

$ npm config get ignore-scripts
true

If the command above returns true, then you need to set the config as false using the following command:

npm config set ignore-scripts false

Once the config has been set to false, try to close and open the console again.

This time, the npm start command should show some output. That means the command is now working.

Conclusion

This tutorial has shown you steps to resolve the npm start command not working.

To run npm start command successfully, you need to have a package.json file with a start script defined in your project’s directory.

You also need to make sure that the ignore-scripts configuration is set to false or you’ll receive no output.

I hope this tutorial is helpful. Until next time! 👋

Table of Contents

Hide

  1. How to fix npm err! missing script: start
    1. Solution 1 – Add the Start Scripts in package.json
    2. Solution 2 – Ensure you have server.js or add the main file in the start script
    3. Solution 3 – Directly run the Node.js script
    4. Solution 4 – Verify the project path before using npm run start command
  2. Conclusion

The npm err! missing script: start occurs if you have not defined the start script in the package.json file or your application doesn’t have a server.js file which node will invoke the server.js to run the application.

In this tutorial, we will take a look at what exactly npm err! missing script: start means and how to resolve the issue with examples.

How to fix npm err! missing script: start

If you are working on the React, node.js type of applications, you would have encountered this issue.

The main reason behind this error is missing the start script in the package.json file.

The package.json is the heart of any node.js application. It holds all the metadata information, dependencies, build scripts, etc.

Unless you define the start script and provide the entry file path in the package.json, node.js won’t know the main entry file to run the application, and hence it throws an error npm err! missing script: start

Solution 1 – Add the Start Scripts in package.json

If you are running the node.js application, add the start script and entry file in the package.json to resolve the issue. If you are running a react application, add the start script as shown below to resolve the issue.

"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
}

Solution 2 – Ensure you have server.js or add the main file in the start script

The start script is not always mandatory in many cases, and we can simply add the server.js file as an entry point to the application or set the relevant script file as the entry point in the package.json, as shown below.

"scripts": {
    "start": "node your-script.js"
}

Solution 3 – Directly run the Node.js script

You can even run the script directly by using the node command. Let’s say you have created a script and want to run using node. You can run it using the below command.

node your-script.js

Solution 4 – Verify the project path before using npm run start command

If you are new to development and following the tutorials to create a new react project and run it for the first time, ensure that you are in the right folder path when running the application using the npm run start command.

Also ensure that you do not have a duplicate script key in the package.json file.

Conclusion

The npm err! missing script: start mainly occurs if you have not specified the entry path in package.json to run the application. 

We can resolve this issue by editing the package.json file and defining the start script path. Alternatively, we can also create a server.js file and specify that as the main entry path in the package.json file.

Sign Up for Our Newsletters

Get notified on the latest articles

By checking this box, you confirm that you have read and are agreeing to our terms of use regarding the storage of the data submitted through this form.

Every Node project comes with a package.json file that contains all the information about your project, including the project’s commands.

Without this file, you won’t be able to run any commands, meaning when you try running npm start, you will get an error like this:

	$ npm start

npm ERR! enoent ENOENT: no such file or directory, open '/package.json'

In this post, we’ll learn about how to fix this issue so you can run your project’s commands.

Creating a package.json file

When you get the above error, it means that you don’t have a package.json file in the directory that you tried running npm start in.

To create a package.json file, you can run this command:

	npm init

This will create a package.json file in the current directory after you complete the inputs.

Creating a start script

By now you should have a package.json file, either created by you or by npm when you ran npm init.

Now you need to make sure there exists a script called start in your package.json file.

Make sure your package.json file looks like this:

	{
    "scripts": {
        "start": "node server.js"
    }
}

If you don’t have this, you will get this error when you try to run npm start:

	npm ERR! Missing script: "start"

Otherwise, your command should run.

Disabling ignore-scripts

One final thing you might have to do is disable the ignore-scripts option in npm.

When this is enabled, it will ignore the scripts in your package.json file.

To disable it, run this command:

	npm config set ignore-scripts false

Once you’ve set this to false and you have a valid script in your package.json file, you should be able to run the command.

Conclusion

In this post, we learned how to resolve the issue of not being able to run your project’s start command.

Once you create a package.json file and a start script, you can run your project’s commands, assuming you have disabled ignore-scripts.

Hopefully, this has been helpful to you. Happy coding!

If you want to learn about web development, founding a start-up, bootstrapping a SaaS, and more, follow me on Twitter! You can also join the conversation over at our official Discord!

  • Support Us

  • Join

  • Share

  • Tweet

  • Share

Give feedback on this page!

Понравилась статья? Поделить с друзьями:
  • Ошибка получения метаданных aloha как исправить
  • Ошибка порше 0179
  • Ошибка получения мандатных атрибутов на сервере для пользователя
  • Ошибка портфолио xml
  • Ошибка предохранителя f1 материнской платы