0

i have created server side folder inside which i have node_modules and package.json.what i want to do is move the node_modules folder outside the server folder.My folder structure is given below: server node_modules controller package.json

suresh
  • 33
  • 4

1 Answers1

0

you can set path for npm_packages.

please find below example - its done on linux, similarly, you might have to do things on your platform

mkdir "${HOME}/.npm-packages"
nano $HOME/.bashrc
NPM_PACKAGES="${HOME}/.npm-packages"
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
PATH="$NPM_PACKAGES/bin:$PATH"
unset MANPATH
MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
#Save and exit
nano $HOME/.npmrc
prefix=${HOME}/.npm-packages
#Save and exit
source ~/.bashrc

UPDATE: i haven't used windows for quite sometime, but what you should do is -> set NPM_PACKAGES in your $PATH(env etc) also add NPM_PACKAGES onto NODE_PATH. next you edit .npmrc and add a prefix in here, something like prefix=${HOME}/.npm-packages

also please follow these links

Specify path to node_modules in package.json

How to change node_modules path in windows

Community
  • 1
  • 1
Oxi
  • 2,918
  • 17
  • 28
  • @suresh : if it works, then you accept/up vote the answer, thats how thanks works in SO – Oxi Feb 02 '16 at 09:39