NPM Install Error on Babylon.js

Fresh install as written here - Start Contributing to Babylon.js | Babylon.js Documentation
After npm install I only get a lot of errors… (which I’ve never had before).

Log attached - 2021-11-29T05_59_28_381Z-debug.zip (35.1 KB)

1 Like

the fastest way to fix that is to change “node-sass”: “^4.14.1” to “sass”: “latest” here .Babylon.js/package.json at master · BabylonJS/Babylon.js · GitHub
and .Babylon.js/package.json at master · BabylonJS/Babylon.js · GitHub and wherever else you find it
If there is a gulp-sass dependency somewhere change it to gulp-dart-sass and change the import.

Sidenotes: the “^” in “node-sass”: “^4.14.1” is , at least in my experience, bad to use for native dependencies because there is a link between the build of node and the build of the binary. its often best to just use 'latest" for native deps. Gyp is kind of f’d because of no maintenance, especially for windows. native packages often ship prebuilt binaries with a fallback to rebuild if no matching prebuilt binaries match your current node version. so, node-sass is trying to rebuild itself and not working, because it rarely works on windows. doesnt work with vs 2022, doesnt find paths even if you hard link them in your global .npmrc . #sad

2 Likes

The current node-sass version we are using doesn’t support node 16. We are using node 10 to 14 during development and testing to make sure we support different versions of node, but we don’t use 16 currently.

I’ll check and see if we can support 10 to 16 in a simple way. Thanks for reporting.

I believe that after finding some solution we’ll need to correct documentation page as well - Start Contributing to Babylon.js | Babylon.js Documentation, it seems a bit outdated and confusing:

  1. The link to the Node.js leads to another site, should be Node.js
    The latest stable release is 16.13.0 LTS

  2. npm latest version currently is 8.1.0 - correct me if I am wrong

npm install latest-version
npm -v

Latest v6 version. Npm broke in v7. Npm changed peer deps install logic. You can revert the peer deps change by adding legacy-peer-deps = true to a .npmrc file btw. It fixes most issues. Except, node 17 breaks webpack because webpack is using crypto hashes instead of content hash and refuse to fix it. Consultant revenue modeled open source projects are such a pain in the ass.

If u dont use scoop on windows, u should check it out . https://scoop.sh/ . The main packes are here .Main/bucket at master · ScoopInstaller/Main · GitHub . Theres a ton more in scoop extras, which u gain access to by “scoop bucket add extras” . Anyway, you can install nvm through scoop then install whatever version of node you want through nvm. Ive found it the least shitty option

Does you answer mean that in order to have Babylon.js locally installed one needs to downgrade node to 14.x.x and npm to 6.x.x versions? (I hope no :slight_smile: )
All my other local projects, including GitHub - BabylonJS/npm-package-template, work with the latest Node and npm versions with no problems.

Yea that is the case for building the repo it seems. Although if you use nvm you can put a .nvmrc file in the repo with node 14 and it should set it up for you automatically. You could try yarn too, it will probably work. Yarn also supports resolutions in package.json which lets you pin versions of things even if a child package declares something different. You can use scoop to install yarn also. Yarn v1 btw, idk what the f they are doing with the next versions of yarn. Some space mountain prolog shit, like 1 guy spent way too long in his basement

Anyway, scoop has lots of other good stuff, like clang , go, zig, blender, godot, databases, etc. really makes dev on windows suck less. Its like chocolatey , but it doesnt destroy your computer

I tried to use Node 14 and npm 6.
Still got errors.
To fix this I uninstalled node-sass using this commands:

npm uninstall -S node-sass
npm uninstall -D node-sass
npm uninstall -g node-sass

And then install it again globally , using:

npm install -g node-sass

After this the build was successful.
Seems there could be somewhere an incompatibility between npm and node-sass versions.

1 Like

node-sass 4 supports node 10 to 14, and node-sass 6 supports node 12-16. I have updated our dependencies (pending approval and merge), so that we should support node => 12.x .
for the time being you will still need to use npm 6, but this will be solved soon as well.

1 Like