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"
}









share|improve this question
























  • 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















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"
}









share|improve this question
























  • 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













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"
}









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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












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.






share|improve this answer























  • I just tried, and I still get the same error.
    – Aristophanes
    yesterday






  • 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













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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
































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.






share|improve this answer























  • I just tried, and I still get the same error.
    – Aristophanes
    yesterday






  • 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

















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.






share|improve this answer























  • I just tried, and I still get the same error.
    – Aristophanes
    yesterday






  • 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















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.






share|improve this answer














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.







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered yesterday









lependu

281110




281110












  • I just tried, and I still get the same error.
    – Aristophanes
    yesterday






  • 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




















  • I just tried, and I still get the same error.
    – Aristophanes
    yesterday






  • 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


















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




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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




















































































Popular posts from this blog

List item for chat from Array inside array React Native

Thiostrepton

Caerphilly