Comments (10)
The issue is that npm root -g
is returning the wrong place - specifically, npm config get prefix
should not be returning ${HOME}/.local/share/npm
. Do you have that defined in ~/.npmrc
? If so, remove it.
from nvm.
aha, ok so that's the problem - that's taking precedence over nvm's npm. if you have a system node/npm, either uninstall/remove them, or, make sure that your PATH puts nvm's dirs in front of /usr/bin
from nvm.
@ljharb Commented prefix
line from my npm config, now it looks likes this:
#prefix=${XDG_DATA_HOME}/npm # don't use with nvm
cache=${XDG_CACHE_HOME}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
logs-dir=${XDG_STATE_HOME}/npm/logs
$ echo $(npm root -g)
/usr/lib/node_modules
However npm install -g forever
returns error:
npm error code EACCES
npm error syscall mkdir
npm error path /usr/lib/node_modules/forever
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/forever'
from nvm.
(to be clear, you shouldn't be using prefix
ever with anything; the location for global modules shouldn't be overridden)
when nvm has a node version used, npm root -g
should return a path that's inside $NVM_DIR
. What does npm config get prefix
return?
from nvm.
npm config get prefix
returns /usr
from nvm.
ok, so that's the problem. is there anything relevant in env | grep -i prefix
?
(do note that tmux sets PREFIX
which makes it incompatible with npm)
from nvm.
is there anything relevant in
env | grep -i prefix
?
Nope, only:
PYTHONPYCACHEPREFIX=/home/user/.cache/python
Not using tmux either
from nvm.
and which npm
still prints ${NVM_DIR}/versions/node/v20.14.0/bin/npm
?
from nvm.
Nope, which npm
returns /usr/bin/npm
from nvm.
This was such a headache and even after multiple attempts over a span of few days I didn't come close to solving this. Ended up burning out and haven't touch node stuff for entire summer.
Just use fnm
so much easier to setup and use, took me couple minute to get it working: https://github.com/Schniz/fnm
yay -S fnm-bin
Add to .zshrc
(or more options: https://github.com/Schniz/fnm#shell-setup)
eval "$(fnm env --use-on-cd --shell zsh)"
from nvm.
Related Issues (20)
- uninstall failed HOT 2
- Consider adding an option for retrying binary downloads before switching to source code compilation or disable fallback to source code compilation if binary cannot be downloaded HOT 4
- [spam]
- "ls-remote",I'm a little confused as to how running that command didn't return the node version. HOT 11
- Unbound variable error with set -u.
- Fail to install with `install.sh` script HOT 5
- install-latest-npm does not work for node>=v14.17 HOT 1
- Potential 0.40.0 regression on Github Actions runners HOT 21
- unable to install nvm HOT 16
- [spam]
- Action Required: Fix Renovate Configuration HOT 7
- On Windows11, how to install nvm in Users profile? HOT 5
- zsh initialization performance HOT 3
- Version 0.40.0, command `nvm install` fails when `$NVM_DIR` path contains spaces HOT 2
- nvm installs node binary for armv7l instead of arm64 HOT 12
- Trash-put involving on nvm usage HOT 2
- [spam]
- `nvm_resolve_local_alias default` has bad performance
- uppercase in .nvmrc are handled differently for `use` and `install` commands HOT 6
- Is the download path of nodejs changed? HOT 2
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 nvm.