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:Usersandrmoll.NORTHAMERICADocumentsGitHubSVIChallengenpm-debug.log
From the debug file:
Error: missing script: start
at run (C:Program Filesnodejsnode_modulesnpmlibrun-script.js:142:19)
at C:Program Filesnodejsnode_modulesnpmlibrun-script.js:58:5
at C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:345:5
at checkBinReferences_ (C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:309:45)
at final (C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:343:3)
at then (C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:113:5)
at C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:300:12
at evalmachine.<anonymous>:334:14
at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-fsgraceful-fs.js:102:5
at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)
![]()
asked Aug 12, 2015 at 22:51
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
RobbieRobbie
18.2k4 gold badges41 silver badges44 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
![]()
nofoobarnofoobar
2,43117 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
11.8k2 gold badges30 silver badges44 bronze badges
answered May 19, 2016 at 8:38
![]()
Dima DorogonovDima Dorogonov
2,0891 gold badge16 silver badges20 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
![]()
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 HDon H
5695 silver badges8 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
![]()
LaCodeMLaCodeM
5257 silver badges21 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
![]()
AliAli
6363 gold badges13 silver badges21 bronze badges
Try this method it will work for you

answered Apr 6, 2021 at 9:38
![]()
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
8,890115 gold badges66 silver badges78 bronze badges
answered Apr 30, 2016 at 13:29
RayRay
2703 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
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
![]()
cherrycherry
3381 gold badge2 silver badges8 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.AKARTHIKEYAN.A
16.6k6 gold badges115 silver badges130 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
![]()
answered May 12, 2016 at 3:07
![]()
drjorgepolancodrjorgepolanco
6,6834 gold badges44 silver badges44 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
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
![]()
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
![]()
DevaDeva
2,3161 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
21.7k20 gold badges66 silver badges75 bronze badges
answered Aug 23, 2018 at 17:48
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
![]()
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
GoodlifeGoodlife
3,7122 gold badges23 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
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
![]()
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:

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
1
Check it package.json file out and find your script name in this file
answered Aug 4, 2022 at 7:49
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 KomaeiM Komaei
5,6152 gold badges19 silver badges29 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
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
1
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.

answered Jan 22 at 10:16
![]()
"scripts": {
"prestart": "npm install",
"start": "http-server -a localhost -p 8000 -c-1"
}
add this code snippet in your package.json, depending on your own configuration.
RobC
21.7k20 gold badges66 silver badges75 bronze badges
answered Mar 10, 2017 at 14:20
I have the same issue. I try to write a code in package.json file as below
"scripts": {
"start": "<your-script-file>.js",
"test": "echo "Error: no test specified" && exit 1"
},
answered Jun 3, 2019 at 11:43
The npm start command is used to run the start command written inside your project’s package.json file.
Sometimes, the command may not work because of a wrong configuration. Here are some steps to fix the npm start command:
- Check if you have a
package.jsonfile in your project - Check if you have a
startscript in the json file - Check if the
ignore-scriptconfig is set totrue
Check if the package.json file exists
First, 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 run the pwd command to see if you are in the right directory. If not, you need to use cd command and move to the right directory.
Once you’re in the project directory, you should see the package.json file listed when running the ls -1 command.
Check if the start script is defined
Next, you need to check if the start script exists inside your package.json file.
When you run the npm start command, you may encounter an error saying that the start script is missing:
$ 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. For most applications, the start script may look as follows:
{
"scripts": {
"start": "node app.js"
},
}
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.
Check the ignore-script config
If you see the start script is present inside your package.json file but still can’t run the script, 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.
Содержание
- How to fix npm start command not working
- Check if the package.json file exists
- Check if the start script is defined
- Check the ignore-script config
- Level up your programming skills
- About
- Common errors
- AppDataRoamingnpm’ on Windows 7 permalink» >
- Ошибка при запуске npm?
- Name already in use
- docs / content / troubleshooting / common-errors.md
How to fix npm start command not working
Posted on Jul 11, 2021
How to fix npm start command not working for your project
The npm start command is used to run the start command written inside your project’s package.json file.
Sometimes, the command may not work because of a wrong configuration. Here are some steps to fix the npm start command:
- Check if you have a package.json file in your project
- Check if you have a start script in the json file
- Check if the ignore-script config is set to true
Check if the package.json file exists
First, 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:
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:
When you don’t see the package.json file, then run the pwd command to see if you are in the right directory. If not, you need to use cd command and move to the right directory.
Once you’re in the project directory, you should see the package.json file listed when running the ls -1 command.
Check if the start script is defined
Next, you need to check if the start script exists inside your package.json file.
When you run the npm start command, you may encounter an error saying that the start script is missing:
This is because while you have a package.json file in your application, the start script is not defined. For most applications, the start script may look as follows:
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.
Check the ignore-script config
If you see the start script is present inside your package.json file but still can’t run the script, 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:
If the command above returns true , then you need to set the config as false using the following command:
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.
Level up your programming skills
I’m sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I’ll send new stuff straight into your inbox!
About
Nathan Sebhastian is a software engineer with a passion for writing tech tutorials.
Learn JavaScript and other web development technology concepts through easy-to-understand explanations written in plain English.
Источник
Common errors
Broken npm installation
If your npm is broken:
- On Mac or Linux, reinstall npm.
- Windows: If you’re on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).
- Some strange issues can be resolved by simply running npm cache clean and trying again.
- If you are having trouble with npm install , use the -verbose option to see more details.
No compatible version found
AppDataRoamingnpm’ on Windows 7 permalink» >
Error: ENOENT, stat ‘C:Users AppDataRoamingnpm’ on Windows 7
The error Error: ENOENT, stat ‘C:Users AppDataRoamingnpm’ on Windows 7 is a consequence of joyent/node#8141, and is an issue with the Node installer for Windows. The workaround is to ensure that C:Users AppDataRoamingnpm exists and is writable with your normal user account.
You are trying to install on a drive that either has no space, or has no permission to write.
- Free some disk space or
- Set the tmp folder somewhere with more space: npm config set tmp /path/to/big/drive/tmp or
- Build Node yourself and install it somewhere writable with lots of space.
You need to install git. Or, you may need to add your git information to your npm profile. You can do this from the command line or the website. For more information, see «Managing your profile settings».
Running a Vagrant box on Windows fails due to path length issues
@drmyersii went through what sounds like a lot of painful trial and error to come up with a working solution involving Windows long paths and some custom Vagrant configuration:
In the code above, I am appending \? to the current directory absolute path. This will actually force the Windows API to allow an increase in the MAX_PATH variable (normally capped at 260). Read more about max path. This is happening during the sharedfolder creation which is intentionally handled by VBoxManage and not Vagrant’s «synced_folder» method. The last bit is pretty self-explanatory; we create the new shared folder and then make sure it’s mounted each time the machine is accessed or touched since Vagrant likes to reload its mounts/shared folders on each load.
npm only uses git: and ssh+git: URLs for GitHub repos, breaking proxies
I fixed this issue for several of my colleagues by running the following two commands:
One thing we noticed is that the .gitconfig used is not always the one expected so if you are on a machine that modified the home path to a shared drive, you need to ensure that your .gitconfig is the same on both your shared drive and in c:users[your user]
You are trying to talk SSL to an unencrypted endpoint. More often than not, this is due to a proxy configuration error (see also this helpful, if dated, guide). In this case, you do not want to disable strict-ssl – you may need to set up a CA / CA file for use with your proxy, but it’s much better to take the time to figure that out than disabling SSL protection.
This problem will happen if you’re running Node 0.6. Please upgrade to node 0.8 or above. See this post for details.
You could also try these workarounds: npm config set ca «» or npm config set strict-ssl false
- upgrade your version of npm npm install npm -g —ca=»»
- tell your current version of npm to use known registrars npm config set ca=»»
If this does not fix the problem, then you may have an SSL-intercepting proxy. (For example, https://github.com/npm/npm/issues/7439#issuecomment-76024878)
Not found / Server error
- It’s most likely a temporary npm registry glitch. Check npm server status and try again later.
- If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package.
- Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later.
- This can be caused by corporate proxies that give HTML responses to package.json requests. Check npm’s proxy configuration.
- Check that it’s not a problem with a package you’re trying to install (e.g. invalid package.json ).
Many ENOENT / ENOTEMPTY errors in output
npm is written to use resources efficiently on install, and part of this is that it tries to do as many things concurrently as is practical. Sometimes this results in race conditions and other synchronization issues. As of npm 2.0.0, a very large number of these issues were addressed. If you see ENOENT lstat , ENOENT chmod , ENOTEMPTY unlink , or something similar in your log output, try updating npm to the latest version. If the problem persists, look at npm/npm#6043 and see if somebody has already discussed your issue.
cb() never called! when using shrinkwrapped dependencies
Take a look at issue #5920. We’re working on fixing this one, but it’s a fairly subtle race condition and it’s taking us a little time. You might try moving your npm-shrinkwrap.json file out of the way until we have this fixed. This has been fixed in versions of npm newer than npm@2.1.5 , so update to npm@latest .
npm login errors
Sometimes npm login fails for no obvious reason. The first thing to do is to log in at https://www.npmjs.com/login and check that your e-mail address on npmjs.com matches the email address you are giving to npm login .
If that’s not the problem, or if you are seeing the message «may not mix password_sha and pbkdf2» , then
- Log in at https://npmjs.com/
- Change password at https://npmjs.com/password – you can even «change» it to the same password
- Clear login-related fields from
/.npmrc – e.g., by running sed -ie ‘/registry.npmjs.org/d’
and it generally seems to work.
npm hangs on Windows at addRemoteTarball
Check if you have two temp directories set in your .npmrc :
Look for lines defining the tmp config variable. If you find more than one, remove all but one of them.
See https://github.com/npm/npm/issues/7590 for more about this unusual problem.
npm not running the latest version on a Windows machine
Источник
Ошибка при запуске npm?
Доброго времени суток. После команды npm start в консоли появляются ошибки. Как можно решить проблему?
0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘start’ ]
2 info using npm@2.11.3
3 info using node@v0.12.7
4 verbose config Skipping project config: C:UsersSergey/.npmrc. (matches userconfig)
5 verbose stack Error: ENOENT, open ‘C:UsersSergeypackage.json’
5 verbose stack at Error (native)
6 verbose cwd C:UsersSergey
7 error Windows_NT 6.1.7601
8 error argv «C:\Program Files\nodejs\node.exe» «C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js» «start»
9 error node v0.12.7
10 error npm v2.11.3
11 error path C:UsersSergeypackage.json
12 error code ENOENT
13 error errno -4058
14 error enoent ENOENT, open ‘C:UsersSergeypackage.json’
14 error enoent This is most likely not a problem with npm itself
14 error enoent and is related to npm not being able to find a file.
15 verbose exit [ -4058, true ]
- Вопрос задан более трёх лет назад
- 5579 просмотров


Начал изучать БЭМ. при запуске npm снова происходит ошибка:
0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘start’ ]
2 info using npm@2.11.3
3 info using node@v0.12.7
4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
5 info prestart bem-project-stub@1.3.1
6 info start bem-project-stub@1.3.1
7 verbose unsafe-perm in lifecycle true
8 info bem-project-stub@1.3.1 Failed to exec start script
9 verbose stack Error: bem-project-stub@1.3.1 start: `enb server`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (C:Program Filesnodejsnode_modulesnpmlibutilslifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess. (C:Program Filesnodejsnode_modulesnpmlibutilsspawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid bem-project-stub@1.3.1
11 verbose cwd C:UsersSergeystart-project
12 error Windows_NT 6.1.7601
13 error argv «C:\Program Files\nodejs\node.exe» «C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js» «start»
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error bem-project-stub@1.3.1 start: `enb server`
17 error Exit status 1
18 error Failed at the bem-project-stub@1.3.1 start script ‘enb server’.
18 error This is most likely a problem with the bem-project-stub package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error enb server
18 error You can get their info via:
18 error npm owner ls bem-project-stub
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
9 verbose stack Error: bem-project-stub@1.3.1 start: `enb server`
9 verbose stack Exit status 1
Источник
Name already in use
docs / content / troubleshooting / common-errors.md
- Go to file T
- Go to line L
- Copy path
- Copy permalink
Copy raw contents
Copy raw contents
Random Errors—One Place to Start
- Some strange issues can be resolved by simply running npm cache clean and trying again.
- If you are having trouble with npm install , use the -verbose option to see more details.
No compatible version found
Please see the discussions in Chapter 2 and Chapter 3 about ways to avoid permissions errors.
Error: ENOENT, stat ‘C:Users AppDataRoamingnpm’ on Windows 7
This is a consequence of joyent/node#8141, and is an issue with the Node installer for Windows. The workaround is to ensure that C:Users AppDataRoamingnpm exists and is writable with your normal user account.
You are trying to install on a drive that either has no space, or has no permission to write.
- Free some disk space or
- Set the tmp folder somewhere with more space: npm config set tmp /path/to/big/drive/tmp or
- Build Node yourself and install it somewhere writable with lots of space.
You need to install git. Or, you may need to add your git information to your npm profile. You can do this from the command line or from the website.
running a Vagrant box on Windows fails due to path length issues
@drmyersii went through what sounds like a lot of painful trial and error to come up with a working solution involving Windows long paths and some custom Vagrant configuration:
In the code above, I am appending \? to the current directory absolute path. This will actually force the Windows API to allow an increase in the MAX_PATH variable (normally capped at 260). Read more about max path. This is happening during the sharedfolder creation which is intentionally handled by VBoxManage and not Vagrant’s «synced_folder» method. The last bit is pretty self-explanatory; we create the new shared folder and then make sure it’s mounted each time the machine is accessed or touched since Vagrant likes to reload its mounts/shared folders on each load.
npm only uses git: and ssh+git: URLs for GitHub repos, breaking proxies
I fixed this issue for several of my colleagues by running the following two commands:
One thing we noticed is that the .gitconfig used is not always the one expected so if you are on a machine that modified the home path to a shared drive, you need to ensure that your .gitconfig is the same on both your shared drive and in c:users[your user]
You are trying to talk SSL to an unencrypted endpoint. More often than not, this is due to a proxy configuration error (see also this helpful, if dated, guide). In this case, you do not want to disable strict-ssl – you may need to set up a CA / CA file for use with your proxy, but it’s much better to take the time to figure that out than disabling SSL protection.
This problem will happen if you’re running Node 0.6. Please upgrade to node 0.8 or above. See this post for details.
You could also try these workarounds: npm config set ca «» or npm config set strict-ssl false
- upgrade your version of npm npm install npm -g —ca=»»
- tell your current version of npm to use known registrars npm config set ca=»»
If this does not fix the problem, then you may have an SSL-intercepting proxy. (For example, npm/npm#7439 (comment))
Not found / Server error
- It’s most likely a temporary npm registry glitch. Check npm server status and try again later.
- If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package.
- Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later.
- This can be caused by corporate proxies that give HTML responses to package.json requests. Check npm’s proxy configuration.
- Check that it’s not a problem with a package you’re trying to install (e.g. invalid package.json ).
Many ENOENT / ENOTEMPTY errors in output
npm is written to use resources efficiently on install, and part of this is that it tries to do as many things concurrently as is practical. Sometimes this results in race conditions and other synchronization issues. As of npm 2.0.0, a very large number of these issues were addressed. If you see ENOENT lstat , ENOENT chmod , ENOTEMPTY unlink , or something similar in your log output, try updating npm to the latest version. If the problem persists, look at npm/npm#6043 and see if somebody has already discussed your issue.
cb() never called! when using shrinkwrapped dependencies
Take a look at issue #5920. We’re working on fixing this one, but it’s a fairly subtle race condition and it’s taking us a little time. You might try moving your npm-shrinkwrap.json file out of the way until we have this fixed. This has been fixed in versions of npm newer than npm@2.1.5 , so update to npm@latest .
npm login errors
Sometimes npm login fails for no obvious reason. The first thing to do is to log in at https://www.npmjs.com/login and check that your e-mail address on npmjs.com matches the email address you are giving to npm login .
If that’s not the problem, or if you are seeing the message «may not mix password_sha and pbkdf2» , then
- Log in at https://npmjs.com/
- Change password at https://npmjs.com/password – you can even «change» it to the same password
- Clear login-related fields from
/.npmrc – e.g., by running sed -ie ‘/registry.npmjs.org/d’
and it generally seems to work.
See npm/npm#6641 (comment) for the history of this issue.
npm hangs on Windows at addRemoteTarball
Check if you have two temp directories set in your .npmrc :
Look for lines defining the tmp config variable. If you find more than one, remove all but one of them.
See npm/npm#7590 for more about this unusual problem.
Why isn’t npm running the latest version on my Windows machine?
Источник
After creating a react app using your favorite method and the next method is mostly done by a developer is npm start which spins up a server in your localhost on port 3000 by default unless or until explicitly mentioned. But sometimes this command leads to an npm err! This is what the blog tries to cover and help fix the error.
Live New Year Sale. Become The Best JavaScript Developer 🚀
Get access to hunderes of practice JavaScript courses, labs, and become employable full-stack JavaScript web developer.
- Free money-back guarantee
- Unlimited access to all platform courses
- 100’s of practice projects included
- GPT-3 Based Instant AI Help
- Structured Full-Stack Web Developer Roadmap To Get A Job
- Exclusive community for events, workshops
Go Pro Now (50% Discount For Limited Time)
Introduction?
There are different errors faced while using npm like broken npm installation, no git, no space, etc. In that way, today we are dealing with the npm error encountered when the start command is not triggered.
Reasons for the error?
There can be more than one possible situation that causes this error. These are as listed:
- Not in the correct project directory
- Your `package.json` file doesn’t contain the start script
Incorrect Project Directory
As soon as you create a new react application it creates a new folder in the present directory and all the files of the react application reside there. You are required to jump into the directory as per the name of your project while creating and then run the npm commands.
Missing npm script in package.json
When a react app is initialized it automatically generates a package.json file. It contains a script key that has several other contents like build, test, and eject. Make sure that it contains the start key with the appropriate command to shoot up the react local server.
Overcome the npm encountered error⚒️
There are 2 ways through which we can avoid this error.
- Run the command in an appropriate directory
- Start command present in package.json
Note: These steps assume that you already have a react project initialized.
Run the npm start command in the appropriate directory
After initializing the react app make sure to checkout to the project directory using the command:
Code language: Bash (bash)
cd <project-name>
After shifting to the project directory run the required command:
Code language: Bash (bash)
npm start
This would partly resolve the error, considering that there is a start script present in the package.json file. Even if this doesn’t solve the issue then continue reading to get the solution.
Ensuring the presence of the start script in package.json
The package.json is the heart of any node project. It contains necessary data about the project which is required before publishing to npm, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package. Hence make sure that there are no issues in package.json.
This is an example package.json which resolves the issue.
Code language: JSON / JSON with Comments (json)
{ "name": "<project-name>", "version": "1.0.0", "scripts": { "start": "react-scripts start" } }
But a more robust script would contain almost all required commands ranging from start to eject. Here is an example:
Code language: JSON / JSON with Comments (json)
"scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }
This is the more predominant snippet found even in many production-ready codebases not to the fullest at least they contain all the required ones.
Also, you need to make sure that there are only a single “scripts” present in the pakage.json file. If there are multiple scripts then the latter one is taken into consideration ignoring the previous instances. Here is a quick walkthrough of the same:
Code language: JSON / JSON with Comments (json)
{ "name": "<project-name>", "version": "1.0.0", <strong>"scripts"</strong>: { "start": "react-scripts start" } <strong>"scripts"</strong>: { "dev" : "node dev.js" } }
The above snippet shows multiple “scripts” present in package.json. If you execute the command:
Code language: Bash (bash)
npm run
then you could observe that only the latter one is considered. Then if we execute the nom start command without this knowledge then again we would face the same npm err! So to avoid the problem we need to combine the text under both scripts and combine them into a single script. Here is an example:
Code language: JSON / JSON with Comments (json)
{ "name": "<project-name>", "version": "1.0.0", <strong>"</strong>scripts<strong>"</strong>: { "start": "react-scripts start" "dev" : "node dev.js" } }
Conclusion?
This blog addresses one of the initial issues encountered i.e. npm ERR! and serves as a blocker to newbies of React which hinders their learning curve. It covers all the potential reasons for facing the issue with various solutions to overcome the error.
A more comprehensive course is being offered by codedamn named Learn NPM – Node Package Manager complete course. It teaches about npm you from scratch and gives a clear walkthrough of all the package.json file as well which is more prominent in this blog.
Live New Year Sale. Become The Best JavaScript Developer 🚀
Get access to hunderes of practice JavaScript courses, labs, and become employable full-stack JavaScript web developer.
- Free money-back guarantee
- Unlimited access to all platform courses
- 100’s of practice projects included
- GPT-3 Based Instant AI Help
- Structured Full-Stack Web Developer Roadmap To Get A Job
- Exclusive community for events, workshops
Go Pro Now (50% Discount For Limited Time)
Learn programming on codedamn
Codedamn is an interactive coding platform with tons of sweet programming courses that can help you land your first coding job. Here’s how:
- Step 1 — Create a free account
- Step 2 — Browse the structured roadmaps (learning paths), or see all courses.
- Step 3 — Practice coding for free on codedamn playgrounds.
- Step 4 — Upgrade to a Pro membership account to unlock all courses and platforms.
Programming is one of the most in-demand jobs today. Learning to program can change your future. All the best!
Hello Everybody,
I’m new to Github, Node and NPM
I try to «start» npm through the terminal in order to link my local development space with a squarespace server
I install and uninstall Node & NPM several times
I read a lot of documentation but I can’t solve the problem
Here is the .log
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘start’ ]
2 info using npm@4.1.2
3 info using node@v7.7.4
4 verbose stack Error: missing script: start
4 verbose stack at run (/usr/local/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /usr/local/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:356:5
4 verbose stack at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:45)
4 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:354:3)
4 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:311:12
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
4 verbose stack at tryToString (fs.js:449:3)
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436:12)
5 verbose cwd /Users/lunalitvak/template
6 error Darwin 15.6.0
7 error argv «/usr/local/bin/node» «/usr/local/bin/npm» «start»
8 error node v7.7.4
9 error npm v4.1.2
10 error missing script: start
11 error If you need help, you may report this error at:
11 error https://github.com/npm/npm/issues
12 verbose exit [ 1, true ]
Thank you in advance for your help !
Cheers,
Luna
@foxandarrows Hello! So, the way npm start works is that it looks in your current package.json for a defined "start" script, and then runs that. The error message you’re seeing is trying to tell you that you have not defined a "start" script in your package.json, hence npm start has no idea what you want it to do.
To solve this issue, all you have to do is add a new script to your package.json. It might look something like this, for example:
{
"name": "package-name",
"version": "1.0.0",
"description": "package description",
"scripts": {
"start": "node lib/server.js",
"test": "echo "Error: no test specified" && exit 1"
},
"dependencies": {},
"devDependencies": {}
}
Note how this package.json has a "start" script that runs node lib/server.js. You’ll definitely want to change the command to whatever is most appropriate for your project.
Let me know if you run into any further npm issues 🙂
@KenanY
Thank you a lot for your clear explanations !
The thing is that I simply wanted to install node and npm and I followed the exact instructions
I read that when you install node & npm, you don’t need to mention a «start» point
But apparently, yes !
The problem is that I have absolutely no idea about which file I have to mention as a starting point. Indeed, I don’t know what node/npm needs in order to work properly
I know it’s not easy if you don’t see the code and previous installation but if you have any idea, don’t hesitate
Thank you already for your help !
Cheers,
Luna
@foxandarrows Yeah, unfortunately you’re right that it’s extremely difficult for me to «guess» what your "start" script should be since there are close to infinite possible scripts. If you’re taken the code from an existing project or tutorial, then maybe the authors could help you out. Good luck!
Hallo mr kenan
I also experienced something like this, but I do not have a file server.js
@ShadamHarizky That file is just an example I made up, so no worries if you don’t have it. You just gotta configure that example "start" script provided and you should be good to go. Good luck!
I changed the package.json like this:
{ "name": "FirstProject", "version": "0.1.0", "private": true, "scripts": { "start": "node node_modules/hawk/lib/server.js", "test": "echo "Error: no test specified" && exit 1" }, "devDependencies": { "react-native-scripts": "1.8.1" } }
Response :
`> FirstProject@0.1.0 start C:ReactFirstProject
node node_modules/hawk/lib/server.js`
some of the npm versions have the issue, some of them don’t, I just solved it by changing my npm version:
npm install -g npm@4.6.1
npm install -g create-react-native-app
create-react-native-app myProj
I had same issue and this is a part that I miss (kind of funny):
Make sure that you save your package.json file and then run the code which is npm start
@KenanY I tried what you provided but it doesn’t work.
@8Ozymandias Please open a new ticket. Make sure to provide a debug log and your package.json. Thanks!
Table of Contents
Hide
- How to fix npm err! missing script: start
- Solution 1 – Add the Start Scripts in package.json
- Solution 2 – Ensure you have server.js or add the main file in the start script
- Solution 3 – Directly run the Node.js script
- Solution 4 – Verify the project path before using npm run start command
- 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.