My shell is zsh
(which I recently switched to and am still learning) and I am trying to create the following alias
:
alias bip39="echo "import('bip39').then((bip) => bip.generateMnemonic()).then((mne) => console.info(mne))" | NODE_PATH="$(npm root -g):$NODE_PATH" node"
When I run exa $(npm root -g)
, I get:
@ceramicnetwork @composedb @web3-storage bip39 corepack npm
Running echo "Node: $(node -v) & NPM $(npm -v)"
returns “Node: v20.15.1 & NPM 10.7.0
“.
Trying the command I want to alias, echo "import('bip39').then((bip) => bip.generateMnemonic()).then((mne) => console.info(mne))" | NODE_PATH="$(npm root -g):" node
, I get:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'bip39' imported from /home/dys/[stdin]
Did you mean to import "bip39/src/index.js"?
Trying to import the suggested path (which I’d really prefer not to do) doesn’t work either.