question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

boilerplate-advancednode: `npm i` fails on Apple Silicon because of incompatible Node version

See original GitHub issue

Note: I’m opening this issue here as it doesn’t seem to be possible to open issues on the boilerplate-advancednode repository.

Affected page

https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/set-up-a-template-engine https://github.com/freeCodeCamp/boilerplate-advancednode/

Your code

Running npm i on an Apple Silicon Mac results in the following error:

npm ERR! code 1
npm ERR! path /Users/ce-dev/Documents/dev/courses/freecodecamp-projects/06 Quality Assurance/boilerplate-advancednode/node_modules/node
npm ERR! command failed
npm ERR! command sh -c node installArchSpecificPackage
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for node-darwin-arm64@12.18.0.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/ce-dev/.npm/_logs/2022-01-21T14_43_20_296Z-debug.log
npm ERR! node:internal/modules/cjs/loader:936
npm ERR!   throw err;
npm ERR!   ^
npm ERR!
npm ERR! Error: Cannot find module 'node-darwin-arm64/package.json'
npm ERR! Require stack:
npm ERR! - /Users/ce-dev/Documents/dev/courses/freecodecamp-projects/06 Quality Assurance/boilerplate-advancednode/node_modules/node/installArchSpecificPackage.js
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR!     at Function.resolve (node:internal/modules/cjs/helpers:108:19)
npm ERR!     at ChildProcess.<anonymous> (/Users/ce-dev/Documents/dev/courses/freecodecamp-projects/06 Quality Assurance/boilerplate-advancednode/node_modules/node-bin-setup/index.js:18:27)
npm ERR!     at ChildProcess.emit (node:events:390:28)
npm ERR!     at maybeClose (node:internal/child_process:1064:16)
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     '/Users/ce-dev/Documents/dev/courses/freecodecamp-projects/06 Quality Assurance/boilerplate-advancednode/node_modules/node/installArchSpecificPackage.js'
npm ERR!   ]
npm ERR! }

This is because node@12.18.0, which is listed as a dependency, does not run on Apple Silicon.

Expected behavior

Users should be able to install dependencies.

System

  • Device: MacBook Air M1
  • OS: MacOS 12.1
  • Browser: n/a

Additional context

Changing the dependencies to the following fixes the problem.

"dependencies": {
  "dotenv": "^8.2.0",
  "express": "^4.16.1",
  "mongodb": "^3.6.1",
  "node": "^17.3.1"
},

Everything still seems to work as I was able to pass the first challenge (“Set up a Template Engine”) with these packages, but I have not done any testing beyond “seems to works on my system and on Heroku”.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ojeytonwilliamscommented, Feb 16, 2022

Is there any major downside to just removing node from the requirements in package.json to bring it in line with other boilerplates?

To be honest, I’m not sure why we have node as a dependency. That’s not how I ever set a node version in practice. I vote we remove that.

It’s useful to recommend compatible node versions (i.e. use engines), but only if we test them to make sure that’s true. We can defer that until we set up testing for the boilerplates - otherwise it’s just annoying and misleading. So, to qualify my previous statement: engines seems useful if we’re running tests.

For now, I’d be fine with just deleting node from the dependencies.

1reaction
naomi-lgbtcommented, Feb 17, 2022

Wanted to confirm the dependency wasn’t present in other boilerplates before closing. Think we’re good to go now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't npm install on Apple Silicon M1 - node.js - Stack Overflow
I'm trying to run a recently cloned Gatsby project on an M1 Mac and it's failing. Getting the following ...
Read more >
electron-builder | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
Bun - Best of JS
Longer-term, bun intends to replace Node.js, Webpack, Babel, yarn, ... It most likely means you're running bun's x64 version on Apple Silicon.
Read more >
npx react-native run-android build failed - You.com
Per the error message, it sounds like npx may be resolving to a legacy react-native binary. If you have previously installed react-native-cli, this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found