# Installing Node with nvm manually in Rust build

**URL:** <https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016>\
**Category:** Windows\
**Created:** [April 14, 2019, 12:16pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016 "2019-04-14T12:16:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdgluck](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/sdgluck/32/1586_2.png) [@sdgluck](https://travis-ci.community/u/sdgluck)\
**Post date:** [April 14, 2019, 12:16pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/1 "2019-04-14T12:16:33Z")

</div>

Hello,

I have a small native Node add-on written with Rust, using [Neon](https://github.com/neon-bindings/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`: [https://github.com/sdgluck/node-crossterm](https://github.com/sdgluck/node-crossterm)

Relevant `before_install` command: [https://github.com/sdgluck/node-crossterm/blob/master/.travis.yml#L106](https://github.com/sdgluck/node-crossterm/blob/master/.travis.yml#L106)

Most recent Travis build: [https://travis-ci.com/sdgluck/node-crossterm/jobs/19277779](https://travis-ci.com/sdgluck/node-crossterm/jobs/19277779)

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

Thank you!

---

<div class="post-metadata">

**Author:** ![dominic](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dominic/32/14_2.png) [@dominic](https://travis-ci.community/u/dominic)\
**Post date:** [April 15, 2019, 9:04pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/2 "2019-04-15T21:04:58Z")

</div>

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

See [NPM not in path](https://travis-ci.community/t/npm-not-in-path/2449/2)

Could you give that a try?

Thanks!

---

<div class="post-metadata">

**Author:** ![dominic](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dominic/32/14_2.png) [@dominic](https://travis-ci.community/u/dominic)\
**Post date:** [April 15, 2019, 9:18pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/3 "2019-04-15T21:18:23Z")

</div>

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

```auto
before_install
  - export NVS_HOME=$ProgramData/nvs
  - git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME
  - source $NVS_HOME/nvs.sh
  - nvs --version
  - nvs add $TRAVIS_NODE_VERSION && nvs use $TRAVIS_NODE_VERSION

```

---

<div class="post-metadata">

**Author:** ![elniallo](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@elniallo](https://travis-ci.community/u/elniallo)\
**Post date:** [April 16, 2019, 5:29am UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/4 "2019-04-16T05:29:28Z")

</div>

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. [https://github.com/elniallo/difficulty-neon](https://github.com/elniallo/difficulty-neon). Will try the above and see if it solves the issue

Edit:  
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](https://travis-ci.community/t/node-js-build-fails-with-no-obvious-error/961)

---

<div class="post-metadata">

**Author:** ![sdgluck](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/sdgluck/32/1586_2.png) [@sdgluck](https://travis-ci.community/u/sdgluck)\
**Post date:** [April 27, 2019, 2:37pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/5 "2019-04-27T14:37:19Z")

</div>

Thank you @dominic, that works!

Now I have some new problems to battle. 😅

---

<div class="post-metadata">

**Author:** ![dominic](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dominic/32/14_2.png) [@dominic](https://travis-ci.community/u/dominic)\
**Post date:** [April 29, 2019, 1:41pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/6 "2019-04-29T13:41:31Z")

</div>

Glad to hear this worked, @sdgluck!

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

---

<div class="post-metadata">

**Author:** ![dominic](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dominic/32/14_2.png) [@dominic](https://travis-ci.community/u/dominic)\
**Post date:** [April 29, 2019, 1:41pm UTC](https://travis-ci.community/t/installing-node-with-nvm-manually-in-rust-build/3016/7 "2019-04-29T13:41:35Z")

</div>


