Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Node to Active LTS version v16 (Gallium) #2574

Merged
merged 2 commits into from
Apr 25, 2022
Merged

Conversation

domoscargin
Copy link
Contributor

@domoscargin domoscargin commented Mar 15, 2022

Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has changed to lockfileVersion 2

This is an internal change that affects development, testing and deployment.

Closes #2504

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2574 March 15, 2022 13:29 Inactive
@domoscargin domoscargin marked this pull request as draft March 22, 2022 08:11
@domoscargin
Copy link
Contributor Author

There are no plans to support M1 with the node-sass compiler. You can switch to the sass compiler instead.

dlmanning/gulp-sass#803 (comment)

@domoscargin
Copy link
Contributor Author

domoscargin commented Mar 22, 2022

I got this working locally on an M1 machine by running:

nvm use
npm uninstall node-sass -g && npm cache clean -force && npm install node-sass
nvm use
npm install

It might be worth deleting the node_modules directory first as well.

@36degrees
Copy link
Contributor

I have a new M1 mac so tried switching to this branch immediately after cloning the repo, installing and using 16.14.0 without having installed or run GOV.UK Frontend under v14, and was able to install and start without any issues. So wondering if this is 'only' an issue for users migrating from 14 to 16.

@vanitabarrett
Copy link
Contributor

@36degrees If that's the case, it sounds like documenting the steps you need to take when going from 14-16 would be enough?

@36degrees
Copy link
Contributor

@vanitabarrett Yes, I think so.

@domoscargin
Copy link
Contributor Author

domoscargin commented Apr 20, 2022

I've done some more testing to confirm that switching from 14 to 16 is the issue.

In that case, I can add some troubleshooting documentation here: https://github.com/alphagov/govuk-frontend/blob/main/docs/contributing/running-locally.md

### Apple silicon troubleshooting
If you have previously installed `govuk-frontend` locally using Node v14 and below, you may encounter problems with the `node-sass` package when updating to Node v16.

To solve this, delete the `node_modules` folder, then run:

nvm use
npm uninstall node-sass -g && npm cache clean -force && npm install node-sass
npm install

Though this does seem like a pretty temporary problem that affects a small group, so we'd probably want to review it down the line.

@EoinShaughnessy Do you have any thoughts?

@EoinShaughnessy
Copy link
Contributor

@domoscargin Hi!

Yeah, I think adding this content is probably a good idea - should help some users, even if only a few.

Do we have an idea of when this issue will no longer affect users?

Also, what sort of problems might they encounter? Would giving an example help users confirm the issue is to do with using Node v14 or earlier?

@domoscargin
Copy link
Contributor Author

Do we have an idea of when this issue will no longer affect users?

Also, what sort of problems might they encounter? Would giving an example help users confirm the issue is to do with using Node v14 or earlier?

This would stop affecting users once everybody who's installed govuk-frontend locally on their M1 with Node v14 has successfully moved to Node v16. This only affects devs/contributors, since most users don't need to install this repo locally.

Once this change is in place, anybody who installs locally for the first time should have no problems. Additionally, if we migrate our build process to Dart Sass (#2239), this problem should go away for anybody who installs after that change. So it's probably a small(ish) pool of users, but with a potentially long tail depending on when they update.

The problem is specifically with the node-sass package. Users will get node-sass related errors when trying to run npm install or npm start (alphagov/govuk-design-system#2110 (comment))

@EoinShaughnessy
Copy link
Contributor

EoinShaughnessy commented Apr 20, 2022

@domoscargin Great explanation, thanks!

Content looks really good! Just suggesting a few tweaks*:

### Fixing update errors
If you've previously installed `govuk-frontend` locally using Node v14 or earlier, you may see `node-sass`-related errors when updating to Node v16.

To get rid of these errors, delete the `node_modules` folder from the `node-sass` package, then run:

nvm use
npm uninstall node-sass -g && npm cache clean -force && npm install node-sass
npm install

*These might be based on my misunderstanding stuff - if so, sorry!

@domoscargin domoscargin force-pushed the bk-bump-node-to-v16 branch 2 times, most recently from 910cc18 to 9467817 Compare April 20, 2022 15:49
@domoscargin domoscargin added documentation User requests new documentation or improvements to existing documentation tooling dependencies Pull requests that update a dependency file labels Apr 20, 2022
@domoscargin domoscargin marked this pull request as ready for review April 20, 2022 16:14
@domoscargin domoscargin requested a review from a team April 20, 2022 16:23
Copy link
Member

@lfdebrux lfdebrux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1️⃣ 6️⃣ 🎉

@domoscargin domoscargin reopened this Apr 25, 2022
Node.js v14 has been in maintenance mode from 19 October 2021. v16 is the active LTS version.

This in turns updates NPM to v8, meaning our lockfile has change to [`lockfileVersion` 2](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion)

This is an internal change that affects development, testing and deployment.
If a user has installed govuk-frontend locally on an M1 machine using Node 14 or lower, `node-sass` will cause errors when running `npm install` or `npm start`.

This can be solved by following the steps in this commit.

This will only affect devs or contributors on Apple silicon who are updating from an older install.
@domoscargin domoscargin merged commit 288c69d into main Apr 25, 2022
@domoscargin domoscargin deleted the bk-bump-node-to-v16 branch April 25, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation User requests new documentation or improvements to existing documentation tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Node.js to active LTS version
6 participants