I want to change the node_modules folder default location to this structure:
application
|
|— client
|— server
| |— node_modules
| |— package.json
| |_ ...
|— server.js
|_ ...
I searched about it and found this question at SO and according to the answer node should look for the packages under each sub-folder, but when i run node server
it throws an error that says that it can't find the packages. To solve it i use the complete path to the package folder: ./server/node_modules/express
, but i would like to only write express
I'm using Node v4.
UPDATE 1
I found a way to do it, but it's a command, so that means that i'll have to run that command when i move the project to the server, or somewhere else?
And this is the command: export NODE_PATH='server'/node_modules
Is there a way to automate the execution of that command?, or a way to define that in a file?