![]() ![]() The folders section is a good structural overview of npm and the config section answers this question. In general, npm's documentation is really helpful. You can run npm config list to see your current config and npm config edit to change it. global ones go into the prefix config variable ( /usr/local by default). Default Config: node_modules/npmconf/config-defs.jsīy default, locally-installed packages go into.Built-In Config File: path/to/npm/itself/npmrc.Global Config File: $PREFIX/etc/npmrc or userconfig param. ![]() User Config File: $HOME/.npmrc or userconfig param.Environment Variables: NPM_CONFIG_PREFIX=./vendor/node_modules.TL DRĮvery configurable attribute of npm can be set in any of six different places. *Even though this is a "global" installation, installed bins won't be accessible through the command line unless ~/foo/vendor/node_modules exists in PATH. Users/pje/foo/vendor/node_modules/bower You can do this by using the -prefix flag and the -global* flag. It should give output on both your own local configuration and the global npm configuration, and you should see your local prefix configuration reflected, probably near the top of the long list of output.įor security, I recommend this approach to configuring your user account's npm behavior over chown-ing your /usr/local folders, which I've seen recommended elsewhere. Then run this command from the command line: npmrc file, set "prefix" to your new npm directory, which will be where "globally" installed npm packages will be installed these "global" packages will, obviously, be available only to your user account. npmrc file (a file that npm uses for user configuration), and create a directory for your npm packages to be installed in (e.g., /Users/yourname/npm). For OSX, you can go to your user's $HOME (probably /Users/yourname/) and, if it doesn't already exist, create an.
0 Comments
Leave a Reply. |