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 Filesnodejsnode.exe’,
- 1 verbose cli ‘C:UsersvkaruthaAppDataRoamingnpmnode_modulesnpmbinnpm-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:UsersvkaruthaAppDataRoamingnpmnode_modulesnpmbinnode-gyp-bin;C:UsersvkaruthaDocumentsReacthello-worldnode_modules.bin;C:ProgramDataOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)WebExProductivity Tools;C:Program Files (x86)CiscoOSD-ShellApplications;C:Program FilesJavajdk1.8.0_101bin;C:Ciscosoftwareapache-maven-3.3.9bin;C:Program FilesGitcmd;C:Program Filesnodejs;C:Program FilesTortoiseSVNbin;C:Program Filesnodejsbin;C:Program Files (x86)SennheiserSoftphoneSDK;C:Program Files (x86)ssh communications securityssh Secure Shell;C:UsersvkaruthaAppDataRoamingnpm;C:Program Files (x86)Microsoft VS Codebin;C:Program Filesnodejsbin
- 10 verbose lifecycle hello-world@0.1.0~start: CWD: C:UsersvkaruthaDocumentsReacthello-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:UsersvkaruthaAppDataRoamingnpmnode_modulesnpmlibutilslifecycle.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:UsersvkaruthaAppDataRoamingnpmnode_modulesnpmlibutilsspawn.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:UsersvkaruthaDocumentsReacthello-world
- 17 error Windows_NT 10.0.10586
- 18 error argv «C:Program Filesnodejsnode.exe» «C:UsersvkaruthaAppDataRoamingnpmnode_modulesnpmbinnpm-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_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 AleniusJens Alenius
1,9022 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
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.6k4 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
nofoobarnofoobar
2,67818 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.9k2 gold badges28 silver badges44 bronze badges
answered May 19, 2016 at 8:38
Dima DorogonovDima Dorogonov
2,2411 gold badge19 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
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
6197 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
LaCodeMLaCodeM
6067 silver badges22 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
6563 gold badges13 silver badges21 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
8,930115 gold badges65 silver badges78 bronze badges
answered Apr 30, 2016 at 13:29
RayRay
2803 silver badges4 bronze badges
1
Try this method it will work for you
answered Apr 6, 2021 at 9:38
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
3361 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
17.6k6 gold badges116 silver badges132 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
7,1515 gold badges46 silver badges45 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,3561 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
22.4k20 gold badges72 silver badges80 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
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
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
GoodlifeGoodlife
3,7722 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
6,4052 gold badges25 silver badges32 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
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 MeyerNeil Meyer
4454 silver badges13 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.
answered Feb 1 at 21:21
1
Доброго времени суток. После команды 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 ]
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:
- Create a
package.json
file in your project - Write the
start
script in thepackage.json
file - Set the
ignore-script
config tofalse
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! 👋
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!