Open iamcam opened 4 years ago
We are having the exactly same issue. Not 100% sure if this worked in the past, but our Android builds broke last week due to the plugin installing Node 17.x when 14.x is required (and defined in the .nvmrc file).
Hi @pehagg @iamcam Sorry I took so long to actually reply :(
Can you share your .nvmrc
file and the output of the nvm
step (plus also the stack you're using) ?
I've tried it out with a very simple Bitrise config and it seems to work ok for me.
A step which does
echo "v14.15.5" > .nvmrc
node -v
The nvm step
A step which prints out node -v
The output on the first step is v12.22.6
for me then it's correctly v14.15.5
Below is the full yaml config
---
format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- opts:
is_expand: false
FASTLANE_WORK_DIR: BitriseTest
- opts:
is_expand: false
FASTLANE_LANE: setup_push
- NVM_VERSION: 0.33.11
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "v14.15.5" > .nvmrc
node -v
- nvm@1:
inputs:
- nvm_version: "$NVM_VERSION"
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
node -v
Hi, sorry for not getting back earlier.
Content of my .nvmrc (doesn't matter if there's a 'v' or not, double-checked this):
v14.17.5
Output from the step:
+------------------------------------------------------------------------------+
| (1) nvm@1 |
+------------------------------------------------------------------------------+
| id: nvm |
| version: 1.3.0 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: bash |
| time: 2021-11-19T08:31:23Z |
+------------------------------------------------------------------------------+
| |
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 14926 100 14926 0 0 331k 0 --:--:-- --:--:-- --:--:-- 323k
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm source string to /root/.profile
=> bash_completion source string already in /root/.profile
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:
/usr/lib
├── @ionic/cli@6.17.1
├── appcenter-cli@2.10.2
├── cordova@10.0.0
├── firebase-tools@9.19.0
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Switching to working directory: /bitrise/src
Downloading and installing node v17.1.0...
Downloading https://nodejs.org/dist/v17.1.0/node-v17.1.0-linux-x64.tar.xz...
## 3.1%
########################################################## 81.9%
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v17.1.0 (npm v8.1.2)
Creating default alias: default -> node (-> v17.1.0 *)
| |
+---+---------------------------------------------------------------+----------+
| ✓ | nvm@1 | 9.06 sec |
+---+---------------------------------------------------------------+----------+
Relevant snippet from the bitrise.yml (I use the Bitrise UI for configuration):
- nvm@1:
inputs:
- node_version: ''
- nvm_version: 0.38.0
No worries @pehagg, I previously took waaaay more time to answer myself 🙈
What's the stack you're using? Looks like Android&Docker on Ubuntu?
I tried it out for this stack and my latest messages on the nmv stack
are these:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Switching to working directory: /bitrise/src
Found '/bitrise/src/.nvmrc' with version <v14.17.5>
Downloading and installing node v14.17.5...
Downloading https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-x64.tar.xz...
## 3.0%
##################################################################### 96.9%
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v14.17.5 (npm v6.14.14)
Creating default alias: default -> v14.17.5 *
Specifically, there are those 2 lines:
Switching to working directory: /bitrise/src
Found '/bitrise/src/.nvmrc' with version <v14.17.5>
Right after switching to the project root directory, nvm install
should find the .nvmrc
and say so
In your case, it looks like it can't find it.
Is your .nvmrc
at the root of your project? If locally, you run nvm install
, does it does it display a similar message?
What's the stack you're using? Looks like Android&Docker on Ubuntu?
That is correct, but I think we have the same issue with the macOS stack as well (haven't tried in a while).
Is your
.nvmrc
at the root of your project? If locally, you runnvm install
, does it does it display a similar message?
Yes, it's in the project root. If I run nvm install in the project root it says it found the config and that the node version in the config file is already installed.
That's weird... I'm having a hard time figuring out what could be the difference between your project and my minimum project here (https://github.com/Almouro/bitrise-nvm-step/issues/13#issuecomment-969146677)
The only thing I could see is making sure Bitrise can in fact see the .nmvrc
, adding a script with ls -la
for instance
Otherwise, would you be able to make a simple reproduction (with a Github project and Bitrise configuration you can share)?
I'll give it a shot as soon as I have time.
I'm running into the issue where the
.nvmrc
file is not being honored - only version values directly entered into the step editor. See #2 ... not sure why it doesn't seem to work in our case. We've got the$BITRISE_SOURCE_DIR
as the working directory