theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Info: Troubleshooting Node Errors and Versions with NVM and NPM #794

Open daveseah opened 8 months ago

daveseah commented 8 months ago

Stub for capturing information about it.

We use NVM to set the version of NodeJS in a project. We specify a specific version of NodeJS in the .nvmrc file inside the project root, but it generally has to be manually set with the nvm use command BEFORE running any npm commands.

The one that matters is what is reported by node -v

When nvm use switches the version of node, it does this by changing the global path to the node binary. However, it does not change the modules loaded in node_modules, so it's good to remove that folder and do npm ci again.

Gotchya: there is also a global node_modules cache from which modules are reinstalled without redownloading them from the internet. This is supposed to work invisibly but in some cases (e.g. poorly versioned libraries) problems with compilation will occur.

When "it runs on my machine" but not others, some sources of problems are:

There are minimum versions of node to use:

dsriseah commented 8 months ago

This issue should be closed by #795