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:
I was having the same problem with a server someone had written a while back. It turns out I didn't have a few things installed that the script required.
This question was helpful to me.
I ended up being able to use:
npm install yourMissingDependency
Although in your instance it may just be a file that it doesn't have a path to. You could try putting that file in the same folder you are running the node script from.
I had a nearly identical issue, turned out my JS file wasn't actually in the folder I was calling it from, and I had gone one folder too deep. I went up one directory, ran the file, it recognized it, happily ever after.
Alternatively, if you go one folder up, and it gives you the same error, but about a different module, take that same file in your parent folder and move it into the subfolder you were previously trying to run things from.
TL;DR- your file or its module(s) is not in the folder you think it is. Go up one level
I had the same problem then I found that I wasn´t hitting the node server command in the proper directory where the server.js is located.
Hope this helps.
Hi fellow Phonegap/Cordova/Ionic developers,
I solved this issue by doing the following
1. C: drive -> Users -> "username" eg. john -> AppData -> Roaming
2. Inside the "Roaming" folder you need to delete both "npm" and "npm-cache"
folder.
3. Now build your project, and it should work
Happy coding!!!
Restart your command prompt and check your path variable (type: path). If you can't find find nodejs installation dir from output add it to the path variable and remember to restart cdm again...
I also got this issue and this was due to wrong path that we mention while running. Check your file path and also make sure that there is no space between the name of your directory name.