google / zx

A tool for writing better scripts

Home Page:https://npmjs.com/package/zx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/bin/bash: nvm: command not found

Qi728 opened this issue · comments

Expected Behavior

┌[einsonBdian.local]-(/Users)
└> nvm -v
0.38.0
┌[einsonBdian.local]-(/Users)
└>

Actual Behavior

/bin/bash: nvm: command not found

Steps to Reproduce the Problem

1.await $nvm use 10.24.0

Specifications

  • Version:4.2.0
  • Platform:mac m1

einson@Bdian:~ % cat ~/.bash_profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion

einson@Bdian:~ %

input in terminal it's useful

bug in mjs command not found

nvm.sh

# Node Version Manager
# Implemented as a POSIX-compliant function
# Should work on sh, dash, bash, ksh, zsh
# To use source this file from your bash profile

nodejs/node#3916

nvm.sh

# Node Version Manager
# Implemented as a POSIX-compliant function
# Should work on sh, dash, bash, ksh, zsh
# To use source this file from your bash profile

nodejs/node#3916

thanks a lot

@Qi728,

But there's a workaround:

child_process.execSync('export NVM_DIR=$HOME/.nvm && source $NVM_DIR/nvm.sh && nvm -v').toString()
// '0.37.2\n'

so you can perform smth like this with zx too:

{
  $.prefix = 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; set -e;'
  await $`nvm -v`
}
// $ nvm -v
// 0.37.2

@Qi728,

But there's a workaround:

child_process.execSync('export NVM_DIR=$HOME/.nvm && source $NVM_DIR/nvm.sh && nvm -v').toString()
// '0.37.2\n'

so you can perform smth like this with zx too:

{
  $.prefix = 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; set -e;'
  await $`nvm -v`
}
// $ nvm -v
// 0.37.2

I love U , bro

ezoic increase your site revenue