Replies: 1 comment
-
Git bash shellIf you want a project independent solution, you can create an alias function in your .bashrc file. If you don't need to get around the function nvm() {
if [ $# -eq 1 ] && [[ "$1" == @(install|use) ]]; then
command nvm "$1" $(cat .nvmrc)
else
command nvm "$@"
fi
} Then you can just call the commands in your shell after switching to the project root: nvm install
nvm use npm scriptIf you still want to use an npm script, you can accomplish that without adding an additional script file:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We cannot do nvm use on windows without the version number but we can setup it up for our projects so we don't need to bother about it every time we run them.
My solution is creating new files:
.nvmrc
.nvmrc-script.bash
and adding a pre-script to the file package.json
e.g:
.nvmrc file content:
v19.4.0
.nvmrc-script.bash file content:
new pre-script:
"prestart": "bash .nvmrc-script.bash",
Enjoy.
Beta Was this translation helpful? Give feedback.
All reactions