Side note: when I install nodejs and npm outside of nvm it seems to work fine.
\nMy .zshrc file contains:
export NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completionHmm oke, this is what I did to fix it.
\nAdding this to .zshrc and .bashrc:
source $HOME/.nvm/nvm.sh\n\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion-
|
I like to use nvm for version control of npm and node. [prod] error in npm.php on line 25:
[prod] run command -v 'npm' || which 'npm' || type -p 'npm'
[prod] exit code 1 (General error)Side note: when I install nodejs and npm outside of nvm it seems to work fine. My 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 |
Beta Was this translation helpful? Give feedback.
-
|
What’s the question? Looks like PATH problem. Note what Deployer uses bash by default. Use absolutely path to you binary. |
Beta Was this translation helpful? Give feedback.
-
|
Hmm oke, this is what I did to fix it. Adding this to source $HOME/.nvm/nvm.sh
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 |
Beta Was this translation helpful? Give feedback.
-
|
otherwise you can use // General setup for NVM and Node.js.
// NVM (Node Version Manager) is sourced to manage Node.js versions.
// The `use_nvm` command ensures NVM is sourced and Node.js is available.
set('nvm', 'source $HOME/.nvm/nvm.sh');
set('use_nvm', function () {
return '{{nvm}} && node --version';
});
// Define tasks to run after the 'deploy:update_code' step.
after('deploy:update_code', [
'nvm:install', // Install Node.js using NVM.
'corepack:enable', // Enable Corepack and prepare Yarn.
'yarn:install', // Install project dependencies using Yarn.
'yarn:build', // Build the project using Yarn.
]);
// Task: Install the required Node.js version using NVM.
task('nvm:install', function () {
cd('{{release_or_current_path}}');
run('{{use_nvm}} && nvm install');
});
// Task: Enable Corepack and prepare Yarn.
task('corepack:enable', function () {
cd('{{release_or_current_path}}');
run('{{use_nvm}} && corepack enable && corepack prepare yarn@stable --activate');
});
// Task: Install project dependencies using Yarn.
// If a previous release exists, reuse its `node_modules` to save time.
task('yarn:install', function () {
if (has('previous_release')) {
if (test('[ -d {{previous_release}}/node_modules ]')) {
run('cp -R {{previous_release}}/node_modules {{release_path}}');
}
}
cd('{{release_or_current_path}}');
run('{{use_nvm}} && yarn install --immutable');
});
// Task: Build the project using Yarn.
task('yarn:build', function () {
cd('{{release_or_current_path}}');
run('{{use_nvm}} && yarn build');
}); |
Beta Was this translation helpful? Give feedback.
Hmm oke, this is what I did to fix it.
Adding this to
.zshrcand.bashrc: