nvm icon indicating copy to clipboard operation
nvm copied to clipboard

Issue in running installed global package's cli

Open gitcommitshow opened this issue 2 years ago • 4 comments

Facing an issue with installing gitcommitshow/open-community-kit globally. The install command runs successfully but its cli cannot be accessed from the terminal

Operating system and version:

nvm debug output:

nvm --version: v0.35.3
$SHELL: /bin/bash
$SHLVL: 1
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.gem/ruby/3.0.0/bin:${HOME}/.rbenv/shims:${NVM_DIR}/versions/node/v14.20.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/opt/[email protected]/bin/
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: /bin/rm
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/local/bin/git, git version 2.30.1
grep: /usr/bin/grep, grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
nvm current: v14.20.0
which node: ${NVM_DIR}/versions/node/v14.20.0/bin/node
which iojs: 
which npm: ${NVM_DIR}/versions/node/v14.20.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v12.18.3
npm root -g: ${NVM_DIR}/versions/node/v12.18.3/lib/node_modules

nvm ls output:

         v4.9.1
        v8.17.0
       v12.18.0
       v12.18.3
      v12.22.12
->     v14.20.0
       v16.17.0
         system
default -> v14 (-> v14.20.0)
node -> stable (-> v16.17.0) (default)
stable -> 16.17 (-> v16.17.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> v16.17.0)
lts/argon -> v4.9.1
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12
lts/fermium -> v14.20.0
lts/gallium -> v16.17.0

How did you install nvm?

Install script in readme

What steps did you perform?

  1. npm install -g open-community-kit
  2. open-community-kit mozilla

What happened?

-bash: open-community-kit: command not found

What did you expect to happen?

The command should have run

Is there anything in any of your profile files that modifies the PATH?

Didn't make any changes in path explicitely except for what was suggested in nvm readme.

gitcommitshow avatar Dec 09 '22 02:12 gitcommitshow

The issue is that you're using node 14, but npm root -g points to a node 12. Have you perhaps defined prefix in ~/.npmrc or your project's .npmrc?

ljharb avatar Dec 09 '22 06:12 ljharb

I see. It's weird. I do see some entries in ~/.npmrc

prefix=${NVM_DIR}/versions/node/v12.18.3
@OWNER:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=secret
@gitcommitshow:registry=https://npm.pkg.github.com/
//registry.npmjs.org/:_authToken=secret

This seems to be probably done during npm package publishing. Is it expected? What is the cleanest way to fix this?

gitcommitshow avatar Dec 09 '22 07:12 gitcommitshow

That prefix entry must be removed and shouldn't ever have been there in the first place. Remove that, and you'll be fine.

ljharb avatar Dec 09 '22 07:12 ljharb

thanks. this works. will figure out how to work with npm packages now.

gitcommitshow avatar Dec 09 '22 17:12 gitcommitshow