Comments (8)
I have investigated it further and the following summarised entry updates both PATH and NODE_PATH work:
# Move global node modules to local directory
NPM_PACKAGES=~/.npm-packages
export NODE_PATH=$NPM_PACKAGES/lib/node_modules:$NODE_PATH
export PATH=$PATH:$NPM_PACKAGES/bin
PATH
still seems to be updated without export
but NODE_PATH
doesn't.
from guides.
The setup actually seems to work without NODE_PATH
, I could not find any documentation on it.
It looks like the setting in .npmrc
is enough for Node to know where to install global packages, and no
further NODE_PATH
setting seems to be needed. At least it works on my machine like that.
from guides.
You're right. I've done some tweaks. PATH
doesn't need to be exported as it already is in all shells.
from guides.
You can also remove step 2 if you rename NPM_PACKAGES
to NPM_CONFIG_PREFIX
. 😉
from guides.
@Rowno I know. It was deliberate. I think it's better to keep it in .npmrc
so it will work when npm is run outside the shell too.
from guides.
I have another question. I successfully changed my dir, but when I install latest npm package it saves it in the Profile dir ~/.npm-packages
and the terminal finds the old version which is still located in /usr/bin/
?
from guides.
@elpiel Did you solve your issue? I have the same.
from guides.
I'm not using MacOS anumore @saulius-spiridonas-ht . Problem solved 😹
from guides.
Related Issues (20)
- `~` doesn't seem to work on every linux as path HOT 6
- ENOENT on npm config get prefix
- Link to npm's docs in the `Install npm packages globally without sudo...` guide? HOT 1
- npm -g without sudo: different npm version? HOT 8
- Better guide for nginx set up and maintainability HOT 1
- MAC OS 10.10.4 no file $HOME/.npmrc HOT 1
- No npm-cli command excuted. HOT 5
- Can I buy you beer for this guide? HOT 2
- How to rebase
- Question about rm -fr HOT 1
- Lost all my npm packages HOT 4
- Yeoman loading fountain-webapp with errors HOT 6
- Official documentation HOT 5
- "Install npm packages globally without sudo" is incompatible with nvm HOT 4
- This is not working on debian 9 HOT 1
- Required fix on docker-without-sudo HOT 1
- File name and context with "global" words should be replaced by "user-wide" in file npm-global-without-sudo.md. HOT 1
- # Docker guide `service` command
- tried all of that #run-docker-commands-without-sudo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guides.