nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
79.62k stars 7.97k forks source link

ENOTDIR: not a directory #3042

Closed civodul999 closed 2 months ago

civodul999 commented 1 year ago

Hi, I have an error when I want to install firebase-tools with specific versions of npm/nvm. No issues with recent version. I also don't know if the error is from firebase or nvm.

Operating system and version:

Ubuntu 20.04.5 LTS

nvm debug output:

```sh $ nvm debug nvm --version: v0.39.2 $SHELL: /bin/bash $SHLVL: 1 whoami: 'steamulo' ${HOME}: /home/steamulo ${NVM_DIR}: '/usr/local/nvm' ${PATH}: ${NVM_DIR}/versions/node/v12.17.0/bin:/usr/lib/jvm/java-11-openjdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/opt/android-sdk-linux/build-tools/25.0.3:/opt/android-sdk-linux/tools/:/opt/android-sdk-linux/build-tools/:/opt/android-sdk-linux/platform-tools/:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/snap/bin $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)' uname -a: 'Linux 5.4.0-139-generic #156-Ubuntu SMP Fri Jan 20 17:27:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux' checksum binary: 'sha256sum' OS version: Ubuntu 20.04.5 LTS curl: /usr/bin/curl, curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3 wget: /usr/bin/wget, GNU Wget 1.20.3 built on linux-gnu. git: /usr/bin/git, git version 2.25.1 grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.4 awk: /usr/bin/awk, GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0) sed: /usr/bin/sed, sed (GNU sed) 4.7 cut: /usr/bin/cut, cut (GNU coreutils) 8.30 basename: /usr/bin/basename, basename (GNU coreutils) 8.30 rm: /usr/bin/rm, rm (GNU coreutils) 8.30 mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.30 xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0 nvm current: v12.17.0 which node: ${NVM_DIR}/versions/node/v12.17.0/bin/node which iojs: which npm: ${NVM_DIR}/versions/node/v12.17.0/bin/npm npm config get prefix: ${NVM_DIR}/versions/node/v12.17.0 npm root -g: ${NVM_DIR}/versions/node/v12.17.0/lib/node_modules ```

nvm ls output:

```sh $ nvm ls v6.17.1 v7.10.1 v8.17.0 v10.20.1 -> v12.17.0 v14.15.0 v16.17.1 v18.9.1 default -> v12.17.0 iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v18.9.1) (default) stable -> 18.9 (-> v18.9.1) (default) lts/* -> lts/hydrogen (-> N/A) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 lts/carbon -> v8.17.0 lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.12 (-> N/A) lts/fermium -> v14.21.3 (-> N/A) lts/gallium -> v16.19.1 (-> N/A) lts/hydrogen -> v18.14.2 (-> N/A) ```

How did you install nvm?

With ansible, the command is

bash -lc "/usr/local/nvm/versions/node/v7.10.1/bin/npm" "install" "-g" "firebase-tools"

Same when I do the command in console.

What steps did you perform?

bash -lc "/usr/local/nvm/versions/node/v7.10.1/bin/npm" "install" "-g" "firebase-tools"

What happened?

Error message is :

npm ERR! Linux 5.4.0-139-generic npm ERR! argv "/usr/local/nvm/versions/node/v12.17.0/bin/node" "/usr/local/nvm/versions/node/v7.10.1/bin/npm" "install" "-g" "firebase-tools" npm ERR! node v12.17.0 npm ERR! npm v4.2.0 npm ERR! path /tmp/npm-392069-417f31fa/unpack-02af7878/package.json npm ERR! code ENOTDIR npm ERR! errno -20 npm ERR! syscall open npm ERR! ENOTDIR: not a directory, open '/tmp/npm-392069-417f31fa/unpack-02af7878/package.json' npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! npm ERR! Please include the following file with any support request: npm ERR! /home/steamulo/.npm/_logs/2023-02-24T16_20_24_019Z-debug.log

What did you expect to happen?

firebase-tools installed with v7.10.1 and also v6.17.1

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

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

```sh ```

Thank you in advance for your help.

ljharb commented 1 year ago

That command decidedly will not work, because the PATH will not be set up properly. You need to have a shell in which nvm.sh is sourced, and then you'd run npm install -g firebase-tools. You'd never want to use the full path to node or npm.