Installing Node with nvm manually in Rust build


I have a small native Node add-on written with Rust, using Neon for bindings. I need to install Node and nvm manually in order to execute the neon compile command which builds the binary.

After much difficulty I have managed to get Travis installing Node via nvm and AFAICT the path to the Node exe is in PATH, however when yarn runs to install dependencies for the project it can’t find Node. If I run node --version it errors with “node command not found”. So clearly I am not adding Node to the PATH correctly, but I don’t see how.

Repository with travis.yml:

Relevant before_install command:

Most recent Travis build:

Some fresh eyes would be much appreciated. How can I get yarn to see Node?

Thank you!

Node.js jobs on Windows are using nvs to install Node.js runtimes instead of npm.

See NPM not in path

Could you give that a try?


Here’s a handy recipe that you can copy/paste:

  - export NVS_HOME=$ProgramData/nvs
  - git clone --single-branch $NVS_HOME
  - source $NVS_HOME/
  - nvs --version
1 Like

I’ve been having the same issue, but the opposite way around, trying to run in the node environment but yarn can’t find rustc. Will try the above and see if it solves the issue

Including the above fixed the build error, however due to another issue with secure environment tokens, the build cannot be deployed to github
see this thread: Node.js build fails with no obvious error

Thank you @dominic, that works!

Now I have some new problems to battle. :sweat_smile:

1 Like

Glad to hear this worked, @sdgluck!

Please open a new topic if we can help you fight the other problems. :wink: