Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server has NodeJS 16 active, but node -v returns version 12 from the github action. #277

Closed
khokonm opened this issue Oct 28, 2023 · 5 comments

Comments

@khokonm
Copy link

khokonm commented Oct 28, 2023

Hi,
I've setup deploy automation for my newly created server. I initially installed node using sudo apt install nodejs, which installed the node version of 12.
Then I installed nvm and switched to node version 16.

Now, whenever I run yarn install or node -v from my SSH terminal. It works fine and return v16.20.2

But yarn install command from the github action returns the following output

out: yarn install v1.22.19
out: [1/4] Resolving packages...
out: [2/4] Fetching packages...
err: error firebase-admin@11.11.0: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.22.9"
out: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
err: error Found incompatible module.

For testing purpose, I added the node -v command in the action YML file, I got the following output

out: v12.22.9
@binamralamsal
Copy link

binamralamsal commented Oct 30, 2023

I am also facing same issue but my node.js version is coming v16.13.2 although I have v20 active on my VPS

Update: I fixed this issue by doing this:

script: |
  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
  # your script here

Basically, it just make sures that v20 is active on your VPS. For some reasons, it doesn't get maintained.

@khokonm
Copy link
Author

khokonm commented Nov 7, 2023

Thanks a lot, it worked like charm!

@stepanjakl
Copy link

Or you could also add the same script to the home/user/.profile, which is read and executed with every log in.

For global configuration (applies to all users), the file is /etc/profile.
For individual user configuration, the file is ~/.bash_profile or ~/.profile.

I am also facing same issue but my node.js version is coming v16.13.2 although I have v20 active on my VPS

Update: I fixed this issue by doing this:

script: |
  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
  # your script here

Basically, it just make sures that v20 is active on your VPS. For some reasons, it doesn't get maintained.

@rafaewaqarqazi
Copy link

Thanks

@appleboy
Copy link
Owner

appleboy commented Jan 7, 2024

See the same solution #21 (comment)

@appleboy appleboy closed this as completed Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants