I installed nodejs in C:\\Program Files (x86)\\nodejs
then I created a .js file and saved it in my desktop just to output \'hello world\' in the console:
npm start
in Node.js Command Prompt.c:\users\MyUser\npm-debug.log
C:\\Program Files\\nodejs\\\\node.exe
Call node.exe + <full path to your server file.js>
Server is listening on port 1337 !
I faced the same problem. I just copied the testNode.js file(that contain the test code) and pasted into the root of nodejs directory manually. I tried this command C:\Program Files (x86)\nodejs>node testnode.js
Bingo! I received this message.
Then I typed this url in a browser and received the message "Hello World". Hope this help somebody.
Faced the same problem while trying to run node-red.
node <directory structure where js is located>/red. js
In my case it was :
node AppData/Roaming/npm/node_modules/node-red/red.js
You need to:
Hide extensions for known file types
from Windows Explorer folders optiontestNode.js.txt
.txt
so as the file to be resolved as JS fileThat's it, now it works!
I had the same problem, but finally I tried copying the Node_modules folder in the same project folder, and it worked.
EDIT: This answer is outdated. With things like Yarn and NPM 5's lockfiles it is now easier to ensure you're dependencies are correct on platforms like Heroku
I had a similar issue related to node_modules
being modified somehow locally but the change was not reflect on Heroku, causing my app to crash. It's relatively easy fix if this is your issue:
# Remove node_modules
rm -fr node_modules
# Reinstall packages
npm i
# Commit changes
git add node_modules
git commit -m 'Fix node_modules dependencies.'
git push heroku master
Hope that helps for others with a similar issue.