Comments (13)
I'm having a similar problem.
In my latest nodejs
version (8.6.0) npm
works fine, but in every other version I'm using (6.11.3, 8.4.0) I'm getting a No such command in 8.4.0 of nodejs
.
A reshim
didn't do anything.
from asdf-nodejs.
@Stratus3D This is definitely an ongoing issue. With Homebrew, the path to global node modules doesn't change between updates, as it's kept in a separate location (/usr/local/lib/node_modules
). But in asdf, the path is something like:
/Users/my_user/.asdf/installs/nodejs/14.11.0/.npm/lib/node_modules
Since it's namespaced by the version number, we lose access to globally installed modules on every update of node.
from asdf-nodejs.
I also have something similar, but it's clean install. I got this error
Already did reshim
but the problem still persists.
from asdf-nodejs.
Another screenshot related to comment above. This one is not about npm, but about the node itself.
I'm sorry if this is the problem from my configuration, I'm pretty new to this stuff.
from asdf-nodejs.
Ah, my bad. Actually, I'm at fault here. I'm cloning the asdf-vm master
current HEAD
instead of the branch v0.2.0
. I'm sorry.
from asdf-nodejs.
I'm actually having this same issue. When I upgrade NPM on one version of node v4.4.5 and npm@3
, and then swap node versions v6.1.0
, then swap back, somehow the npm version in the v.4.4.5
install goes back to v2.15.5
.
from asdf-nodejs.
Having the same issue here. Any help?
from asdf-nodejs.
Having the same issue NPM "command not found" after installing with asdf
from asdf-nodejs.
I am unable to use global packages on older versions of nodejs same as @stefanfrede reshim does nothing
from asdf-nodejs.
@ndarilek is this still an issue?
from asdf-nodejs.
Hmm... just a question, does asdf support migrating global packages into the new nodejs installation, such us: nvm install node --reinstall-packages-from=node
in nvm
. For example: I installed eslint
globally in node 8.15.1, then I install the node 12.14.1 and set node 12.14.1 as current global version. Currently, the eslint
bin only exists on 8.15.1, but not on the new 12.14.1... 🙇♂️
from asdf-nodejs.
cc: @Stratus3D. Here's my result.
asdf-vm: v0.7.8-4a3e3d6
asdf-nodejs: cd8dc32e82507a229fe90c0b01d1089a3ac6844c
nodejs: v12.16.2
Plan/Execution Step
I have create-next-app
global cli in nodejs v12.16.2 LTS. Now, I want to upgrade my nodejs to v12.18.3 LTS. After that, I expect that the create-next-app
still available while I have upgraded the node to v12.18.3 LTS.
- Check
node --version
->v12.16.2
. - Install
create-next-app
as global cli usingnpm install -g create-next-app
. - Run
asdf reshim nodejs
. - Check
create-next-app
has bee listed usingnpm ls -g --depth=0
. - Update asdf-nodejs plugin using
asdf plugin update nodejs
. - Install nodejs 12.18.3 LTS by using
NODEJS_CHECK_SIGNATURES=no asdf install nodejs 12.18.3
(I need to bypass the signature checking since my gpg setting doesn't allow weak digest). - Ensure nodejs 12.18.3 has been installed by using
asdf list nodejs | grep 12.18.3
. - Change global nodejs version to 12.18.3 by using
asdf global nodejs 12.18.3
. - Run reshim again
asdf reshim nodejs
. - Ensure nodejs has been upgrade by using
node --version
->v12.18.3
. - Check
create-next-app
cli is still available while upgrading to nodejs 12.18.3 by usingnpm ls -g --depth=0
.
Expected Behavior
create-next-app
is still available in node v12.18.3.
Actual Behavior
create-next-app
is not available in node v12.18.3.
➜ npm ls -g --depth=0
/home/jeffryangtoni/.asdf/installs/nodejs/12.18.3/.npm/lib
└── (empty)
Probably asdf need to support this feature from nvm
? nvm install node --reinstall-packages-from=node
🙇
from asdf-nodejs.
There are some traps around sharing global installs between node versions, mostly incompatibilities. Some packages only support specific node versions. Others need to be built against a specific version (node-sass is famous for doing it for maximum performance).
If you ever share the packages between versions, you need to be aware that depending on the context you are in, in a project with a different node version than your global installation for example, your global commands might not work, and you will get errors, npm
itself is a globally installed package that needs specific node versions and might not work in different contexts.
As of now, you can have a command in installed all versions by setting up default npm packages that are installed automatically after every asdf install nodejs $version
. A nice oneliner for installing a global command in every version is:
npm_install_all_versions() {
for pkg; do
asdf list nodejs | xargs -n1 -I{} env ASDF_NODEJS_VERSION="{}" npm install -g "$pkg"
done
}
npm_install_all_versions npm typescript tldr
After making that clear, I totally think that is possible to have global and version-specific installations utilizing of path priority and the prefix npm config that might ease this problem. I will look into something this week
from asdf-nodejs.
Related Issues (20)
- install script assumes path of asdf HOT 2
- Differing commands when installing 14.19.3 on MacOS/ZSH have weird results
- Force compile flag has a typo HOT 3
- Ability to skip installing default npm packages HOT 3
- Issues in running test scripts from Eclipse with Appium shim HOT 1
- bug: nodejs plugin segfault with node `11.1.0` HOT 4
- Resolving LTS version only outputs major number HOT 4
- npm shim should work without $HOME HOT 5
- Unable to install 18.18.1 HOT 1
- import-release-team-keyring not found HOT 1
- NodeJS 18.18.2 is not in the list! HOT 2
- Can't install 21.0.0 HOT 4
- bug: asdf cannot resolve config paths with whitespace in them HOT 2
- Last version is 20.5.1 but Node is already at 21.0.2 HOT 1
- asdf cant find definition for v18.19.0 HOT 2
- Dependency on nvm HOT 1
- How to install Nodejs latest LTS version? HOT 1
- default-npm-packages support registry
- asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). But asdf: Warn: the current plugin (nodejs) does not support that. Downloaded files will not be preserved. HOT 2
- not using project .tool-versions to set node version in tmux
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 asdf-nodejs.