on running node filename i get the following error :
module.js:341
throw err;
Error: Cannot find module 'prompt'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/Users/rohit/Checkout/codeDetect/codedetect_test.js:2:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
After this the node command did work perfectly.
But i am having only the one js file in my directory and it probably installed prompt module somewhere in parent directory.
If i commit this file then if anyone who wants to use it has to say manually install all the modules with npm install.. but here as it is only one file its not that much of a problem. So i feel there should be a better way which will automatically install all the require dependencies rather than erroring out and doing npm install for each one ?
Also should i commit the node_modules folder so that user does not need to run npm install ?
Please provide some guide on how to correctly perform and run node js code.
Thanks
Thanks that was helpful.
the command npm install <package name> --save does save the dependency info into the package.json file.
So i guess whenever a user will checkout my repo and perform npm install all the dependencies listed in package.json will be installed automatically ? and so no need to keep track of npm_modules ...
Also one thing here is that.. say my js file has 10 dependencies than in this case the first time i do need to run npm install <package-name> 10 times ? Is there any way to avoid that...
ASKER
the command npm install <package name> --save does save the dependency info into the package.json file.
So i guess whenever a user will checkout my repo and perform npm install all the dependencies listed in package.json will be installed automatically ? and so no need to keep track of npm_modules ...
Also one thing here is that.. say my js file has 10 dependencies than in this case the first time i do need to run npm install <package-name> 10 times ? Is there any way to avoid that...