Dennis

Dennis

Live

Currently Ploi installs node/npm LTS version. We have some projects that need an older version of node/npm to build assets, so it would be very helpful for us to have a node version manager installed by Ploi so that we can switch node version in the deploy script. For example nvm or n.

They both have the option to set a dot file in your repo and it will set the correct node version from that file. github.com/nvm-sh/nvm/blob/master/README.md#nvmrc github.com/tj/n#specifying-node-versions Once a user added the file to their project they will only need to add nvm use or n auto to their project.

Saeed Rehman

Saeed Rehman

·
·

Very much needed. To be Honest I have a legacy project that is vey critical and running on Node 10.2. We started it in 2018 on LaravelForge. One of the reasons for not migrating it to Ploi yet is that I am too lazy to install Old node version manually.

no votes yet
jurgen

jurgen

·
·

Ow yeah! This would be nice to have!

no votes yet
Anees Khan

Anees Khan

·
·
no votes yet
jurgen

jurgen

·
·

FYI, for now I install nvm on behalf of the user of the website and in the deploy script I put: . ~/.nvm/nvm.sh && nvm use 16

no votes yet
Dennis

Dennis

Item author
·
·

@Jurgen Indeed, this is fine and will probably also work with the installation with Ploi.

no votes yet
Dennis

Dennis

Item author
· · Edited
·

Via the manage tab, you may now install NVM or N (up to you), we're still checking of we can expand functionality.

2 total votes
jurgen
Tim Kleyersburg

Tim Kleyersburg

· · Edited
·

@Dennis I've tried using this feature today by first installing nvm on the server over the manage tab and then just using the command nvm use auto in my deploy script. This outputs ploi.sh: line 8: nvm: command not found

Can you tell me/us how to correctly use this feature?

2 total votes
Cristian Balan Steets
Tim Kleyersburg

Tim Kleyersburg

·
·

@Dennis just revisiting this. I've also didn't find nvm on the server anywhere. Is this correctly working?

no votes yet
Sander Jonk

Sander Jonk

·
·

I'm having the same issue. There seems to be no NVM after installing it through Ploi.

no votes yet
jurgen

jurgen

·
·

@Dennis could you please take a look? It's sad to see this issue still open. Shouldn't be that difficult to make NVM available to all system users one would think. Thanks in advance

no votes yet
SMIT.

SMIT.

·
·

@Jurgen Without some weird quirky workarounds it actually is pretty difficult :(

no votes yet
DREIST Werbeagentur OG

DREIST Werbeagentur OG

·
·

looks like nvm gets installed in the home dir of the root user

/root/.nvm
no votes yet
jurgen

jurgen

·
·

For the time being you can install it per system user.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash

See https://github.com/nvm-sh/nvm.

no votes yet
SMIT.

SMIT.

·
·

There are multiple issues to solve here, for example:

  • using nvm on other users then Ploi
  • pm2 is still run on "system node"
  • What about globally installed npm packages.

I think i have a dirty workaround for the first issue that requires some, keep in mind this is not production ready, use at your own risk.

Install nvm via the ploi user

mkdir /usr/local/nvm
curl https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | NVM_DIR=/usr/local/nvm bash

The dirty path

that should be changed with group privileges for example but did not get this to work yet. This makes it so every user can install and use nvm cache.

mkdir /usr/local/nvm/.cache && chmod -R 777 /usr/local/nvm/.cache
mkdir /usr/local/nvm/versions && chmod -R 777 /usr/local/nvm/versions
mkdir /usr/local/nvm/alias && chmod -R 777 /usr/local/nvm/alias

Add nvm init to profiles

echo 'export NVM_DIR="/usr/local/nvm"' | sudo tee -a /etc/profile.d/nvm.sh
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | sudo tee -a /etc/profile.d/nvm.sh
no votes yet
René Sinnbeck

René Sinnbeck

· · Edited
·

This seems to still not be working as expected.

@Dennis Should it perhaps be moved to In progress again?

4 total votes
Cristian Balan Stefan dev Tim Kleyersburg
kovinet

kovinet

· · Edited
·

So I installed NVM via Ploi but even the default ploi user doens't have access to ploi in terminal, I get Command 'nvm' not found error (Ubuntu 22 on Hetzner)

1 total vote
boundless
Cristian Balan

Cristian Balan

· · Edited
·

According to https://stackoverflow.com/questions/11542846/nvm-node-js-recommended-install-for-all-users#comment58129097_19040346

... you should NOT EVER install nvm as root. nvm is per-user. If you want to share node across users, nvm is the wrong tool to use.

no votes yet
You may use @ to mention someone.

Node version manager

35 total votes
  • Dennis moved item to board Live

    1 year ago
  • Dennis moved item to board In progress

    1 year ago
  • Dennis opened

    2 years ago