NPM start script missing
up vote
-1
down vote
favorite
I am trying to use the npm start command but I don't have the correct "start" script in my package.json. Can anyone please tell me the correct way to add it?
I have tried adding "start": "node server.js" to my scripts in package.json but that throws up an error:
> node server.js
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'C:UsersAristophanesserver.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aristophanes@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aristophanes@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAristophanesAppDataRoamingnpm-cache_logs2018-11-10T11_34_37_097Z-debug.log
So it can't find a server.js file. Can anyone elaborate what file exactly I'm supposed to be looking for to add to the "start" script? Package.json:
{
"name": "aristophanes",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC"
}
node.js npm npm-scripts
add a comment |
up vote
-1
down vote
favorite
I am trying to use the npm start command but I don't have the correct "start" script in my package.json. Can anyone please tell me the correct way to add it?
I have tried adding "start": "node server.js" to my scripts in package.json but that throws up an error:
> node server.js
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'C:UsersAristophanesserver.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aristophanes@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aristophanes@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAristophanesAppDataRoamingnpm-cache_logs2018-11-10T11_34_37_097Z-debug.log
So it can't find a server.js file. Can anyone elaborate what file exactly I'm supposed to be looking for to add to the "start" script? Package.json:
{
"name": "aristophanes",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC"
}
node.js npm npm-scripts
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am trying to use the npm start command but I don't have the correct "start" script in my package.json. Can anyone please tell me the correct way to add it?
I have tried adding "start": "node server.js" to my scripts in package.json but that throws up an error:
> node server.js
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'C:UsersAristophanesserver.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aristophanes@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aristophanes@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAristophanesAppDataRoamingnpm-cache_logs2018-11-10T11_34_37_097Z-debug.log
So it can't find a server.js file. Can anyone elaborate what file exactly I'm supposed to be looking for to add to the "start" script? Package.json:
{
"name": "aristophanes",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC"
}
node.js npm npm-scripts
I am trying to use the npm start command but I don't have the correct "start" script in my package.json. Can anyone please tell me the correct way to add it?
I have tried adding "start": "node server.js" to my scripts in package.json but that throws up an error:
> node server.js
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'C:UsersAristophanesserver.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:308:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aristophanes@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aristophanes@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAristophanesAppDataRoamingnpm-cache_logs2018-11-10T11_34_37_097Z-debug.log
So it can't find a server.js file. Can anyone elaborate what file exactly I'm supposed to be looking for to add to the "start" script? Package.json:
{
"name": "aristophanes",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC"
}
node.js npm npm-scripts
node.js npm npm-scripts
edited yesterday
asked yesterday
Aristophanes
237
237
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday
add a comment |
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try to change "main": "server.js" in your package.json
Edit: You have to define the file name as main which contains your server.listen callback. Also you can start running with node [your-server-file].js If your file name is index.js node finds it automatically, no need the main part.
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
Edited. Also note that theError: Cannot find module 'C:UsersAristophanesserver.js'says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.
– lependu
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try to change "main": "server.js" in your package.json
Edit: You have to define the file name as main which contains your server.listen callback. Also you can start running with node [your-server-file].js If your file name is index.js node finds it automatically, no need the main part.
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
Edited. Also note that theError: Cannot find module 'C:UsersAristophanesserver.js'says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.
– lependu
yesterday
add a comment |
up vote
0
down vote
Try to change "main": "server.js" in your package.json
Edit: You have to define the file name as main which contains your server.listen callback. Also you can start running with node [your-server-file].js If your file name is index.js node finds it automatically, no need the main part.
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
Edited. Also note that theError: Cannot find module 'C:UsersAristophanesserver.js'says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.
– lependu
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
Try to change "main": "server.js" in your package.json
Edit: You have to define the file name as main which contains your server.listen callback. Also you can start running with node [your-server-file].js If your file name is index.js node finds it automatically, no need the main part.
Try to change "main": "server.js" in your package.json
Edit: You have to define the file name as main which contains your server.listen callback. Also you can start running with node [your-server-file].js If your file name is index.js node finds it automatically, no need the main part.
edited yesterday
answered yesterday
lependu
281110
281110
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
Edited. Also note that theError: Cannot find module 'C:UsersAristophanesserver.js'says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.
– lependu
yesterday
add a comment |
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
Edited. Also note that theError: Cannot find module 'C:UsersAristophanesserver.js'says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.
– lependu
yesterday
I just tried, and I still get the same error.
– Aristophanes
yesterday
I just tried, and I still get the same error.
– Aristophanes
yesterday
1
1
Edited. Also note that the
Error: Cannot find module 'C:UsersAristophanesserver.js' says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.– lependu
yesterday
Edited. Also note that the
Error: Cannot find module 'C:UsersAristophanesserver.js' says there is no server.js in the directory. So you are either in the wrong directory, or you named your file something else than server.js.– lependu
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238380%2fnpm-start-script-missing%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
It can't find C:UsersAristophanesserver.js because there is no server.js. What are you trying to start?
– estus
yesterday
Could you please share your directory structure. This should work as you describe as long as you have a server.js file next to your package.json.
– tenor528
yesterday