When I try to tun my project on node, I have to write the full path for my javascript file because the default value node uses is C:\Users\MyUser
and I refuse to use it.
I've been trying to find how to change this but have not found it anywhere. I even tried searching the directory manually for it and had no luck finding it.
Could anyone point me on how to fix this annoying little problem I have?
You can mean to change default directory for "Node.js command prompt", when you launch it. If so, then (Windows case)
change the default path in the row which looks like
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%"
with your path. It could be for example
if "%CD%\"=="%~dp0" cd /d "c://MyDirectory/"
if you mean to change directory once when you launched "Node.js command prompt", then you can run in the command line of NodeJS command prompt:
cd c:/MyDirectory/
Node's "default" directory is the Windows home directory. Note, you can change node's home directory using process.chdir(directory)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With