sass / node-sass

:rainbow: Node.js bindings to libsass

Home Page:https://npmjs.org/package/node-sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install node-sass 9.0.0 on node 20

LaurensRietveld opened this issue · comments

Version details

  • NPM version (npm -v): 9.6.6
  • Node version (node -v): v20.2.0
  • Node Process (node -p process.versions):
{
  node: '20.2.0',
  acorn: '8.8.2',
  ada: '2.4.0',
  ares: '1.19.0',
  base64: '0.5.0',
  brotli: '1.0.9',
  cjs_module_lexer: '1.2.2',
  cldr: '43.0',
  icu: '73.1',
  llhttp: '8.1.0',
  modules: '115',
  napi: '8',
  nghttp2: '1.52.0',
  nghttp3: '0.7.0',
  ngtcp2: '0.8.1',
  openssl: '3.0.8+quic',
  simdutf: '3.2.9',
  tz: '2023c',
  undici: '5.22.0',
  unicode: '15.0',
  uv: '1.44.2',
  uvwasi: '0.0.16',
  v8: '11.3.244.8-node.9',
  zlib: '1.2.13'
}
  • Node Platform (node -p process.platform): linux
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): 9.0.0
  • npm node-sass versions (npm ls node-sass): ``-- node-sass@9.0.0`

Problem

It is not possible to install node-sass 9.0.0 on node 20 without python

> docker run -it --rm node:20-bullseye-slim bash
# inside the container:
>  mkdir test && cd test && yarn init -y
> yarn add node-sass

Note that if I use the node:18-bullseye-slim image and install node-sass@8.0.0, then the installation works fine

Bindings are attached to the release and downloaded during install, they're not bundled with the NPM package

Thanks for the correction!
I've updated the issue description

You haven't provided any error message, you just keep saying it's missing something. You may have a dependency with a dependency on a version older than v9, which won't work on Node 20

see here (this is the output of the sequence of commands I posted in the OP)

root@16b4ab8bc980:/# mkdir test
root@16b4ab8bc980:/# cd test/
root@16b4ab8bc980:/test# yarn init -y
yarn init v1.22.19
warning The yes flag has been set. This will automatically answer yes to all questions, which may have security implications.
success Saved package.json
Done in 0.01s.
root@16b4ab8bc980:/test# yarn add node-sass
yarn add v1.22.19
warning package.json: "test" is also the name of a node core module
info No lockfile found.
warning test@1.0.0: "test" is also the name of a node core module
[1/4] Resolving packages...
warning node-sass > make-fetch-happen > cacache > @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
warning node-sass > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /test/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /test/node_modules/node-sass
Output:
Binary found at /test/node_modules/node-sass/vendor/linux-x64-115/binding.node
Testing binary
Binary has a problem: Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /test/node_modules/node-sass/vendor/linux-x64-115/binding.node)
    at Module._extensions..node (node:internal/modules/cjs/loader:1341:18)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at module.exports (/test/node_modules/node-sass/lib/binding.js:19:10)
    at Object.<anonymous> (/test/node_modules/node-sass/lib/index.js:13:35)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32) {
  code: 'ERR_DLOPEN_FAILED'
}
Building the binary locally
Building: /usr/local/bin/node /test/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/test/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@8.4.1
gyp info using node@20.2.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - "python3" is not in PATH or produced an error
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - "python" is not in PATH or produced an error
gyp ERR! find Python 
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python 
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/test/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/test/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/test/node_modules/node-gyp/lib/find-python.js:202:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/test/node_modules/node-gyp/lib/find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:511:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:483:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Linux 5.19.0-42-generic
gyp ERR! command "/usr/local/bin/node" "/test/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /test/node_modules/node-sass
gyp ERR! node -v v20.2.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok 
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

@xzyfer I wonder if the GLIBC error is related to the newer bindings?

Bindings are attached to the release and downloaded during install, they're not bundled with the NPM package

Just a followup on this one, as I'm still confused. Should we expect differences between 8.0.0 and 9.0.0 wrt the bundled files? As npmjs shows, 8.0.0 contains a vendor subdirectory (see here) where 9.0.0 does not (see here)

@LaurensRietveld directory is created as part of the install process. Can you confirm whether you're able to install V8 on Node 20?

@nschonni it could be related

@LaurensRietveld directory is created as part of the install process. Can you confirm whether you're able to install V8 on Node 20?

If that directory is created as part of the install process, then I wouldn't expect that folder to show up in the published npm package. The links above indicate that the directory is created as part of the publication

With respect to v8: do you mean the libv8-dev package? I can install that on node20:

docker run -it --rm node:20-bullseye-slim bash -c "apt update && apt install -y libv8-dev"

The vendor directory is sometimes published because I publish the release from my local install, which already have a vendor directory that I forgot to delete.

Sorry, I mean can you try installing node-sass 9 on node 18. I'm trying to determine if the issue is specific to the combination of node-sass v9 on Linux with mode 20.

It seems to be specific to node 20 indeed. The following sequence of commands installs node-sass@9.0.0 fine:

> docker run -it --rm node:18-bullseye-slim bash
# inside the container:

mkdir test
cd test/
yarn init -y
yarn add node-sass

Thanks. This suggests I'll need to rebuild the binary tomorrow. I'll update this issue when the new binary has been uploaded

Update the linux binary for Node 20. Was able to do an install successfully locally.

@LaurensRietveld please give it a shot now. I replaced the binary on the existing release so there's no need for a 9.0.1 release.

Excellent, this seems to have fixed it. Many thanks!