Code Monkey home page Code Monkey logo

Comments (13)

stefanfrede avatar stefanfrede commented on May 30, 2024 3

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.

dustypomerleau avatar dustypomerleau commented on May 30, 2024 3

@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.

muhifauzan avatar muhifauzan commented on May 30, 2024

I also have something similar, but it's clean install. I got this error

image

Already did reshim but the problem still persists.

from asdf-nodejs.

muhifauzan avatar muhifauzan commented on May 30, 2024

Another screenshot related to comment above. This one is not about npm, but about the node itself.

image

I'm sorry if this is the problem from my configuration, I'm pretty new to this stuff.

from asdf-nodejs.

muhifauzan avatar muhifauzan commented on May 30, 2024

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.

zmackie avatar zmackie commented on May 30, 2024

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.

sethetter avatar sethetter commented on May 30, 2024

Having the same issue here. Any help?

from asdf-nodejs.

sublimecoder avatar sublimecoder commented on May 30, 2024

Having the same issue NPM "command not found" after installing with asdf

from asdf-nodejs.

joemsak avatar joemsak commented on May 30, 2024

I am unable to use global packages on older versions of nodejs same as @stefanfrede reshim does nothing

from asdf-nodejs.

Stratus3D avatar Stratus3D commented on May 30, 2024

@ndarilek is this still an issue?

from asdf-nodejs.

jeffryang24 avatar jeffryang24 commented on May 30, 2024

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.

jeffryang24 avatar jeffryang24 commented on May 30, 2024

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.

  1. Check node --version -> v12.16.2.
  2. Install create-next-app as global cli using npm install -g create-next-app.
  3. Run asdf reshim nodejs.
  4. Check create-next-app has bee listed using npm ls -g --depth=0.
  5. Update asdf-nodejs plugin using asdf plugin update nodejs.
  6. 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).
  7. Ensure nodejs 12.18.3 has been installed by using asdf list nodejs | grep 12.18.3.
  8. Change global nodejs version to 12.18.3 by using asdf global nodejs 12.18.3.
  9. Run reshim again asdf reshim nodejs.
  10. Ensure nodejs has been upgrade by using node --version -> v12.18.3.
  11. Check create-next-app cli is still available while upgrading to nodejs 12.18.3 by using npm 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.

augustobmoura avatar augustobmoura commented on May 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.