executablebooks / sphinx-book-theme

A clean book theme for scientific explanations and documentation with Sphinx
https://sphinx-book-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
429 stars 198 forks source link

1.0.0 unable to build with system node #706

Open dvzrv opened 1 year ago

dvzrv commented 1 year ago

Describe the bug

context Hi! I package scons for Arch Linux. As they have now switched to (also) using sphinx-book-theme I need to package this project. Unfortunately building the package fails as I can not use the system version of node (and downloading the internet during build is not good). Instead of 16.13.2 I'm using 16.19.1.

(somewhat) Related to https://github.com/pradyunsg/sphinx-theme-builder/issues/32

expectation Using nodejs of the same major version does not break the build.

bug Using

* Getting build dependencies for wheel...
* Building wheel...
[stb] # nodeenv does not exist.
[stb] # Generating new nodeenv with NodeJS 16.19.1!
[stb] # Will use system nodeJS.
[stb] $ python -m nodeenv --node=system --prebuilt --clean-src /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/.nodeenv
which: no nodejs in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
[stb] (nodeenv) $ node --version
v16.19.1
[stb] # Installing NodeJS packages.
[stb] (nodeenv) $ npm install --include=dev
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues.
Please, upgrade your dependencies to the actual version of core-js.

added 983 packages, and audited 984 packages in 19s

94 packages are looking for funding
  run `npm fund` for details

18 vulnerabilities (1 low, 17 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.6.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.1
npm notice Run npm install -g npm@9.6.1 to update!
npm notice
[stb] (nodeenv) $ npm run-script build

> build
> webpack

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/webpack/lib/NormalModule.js:471:10)
    at /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/webpack/lib/NormalModule.js:503:5
    at /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/webpack/lib/NormalModule.js:358:12
    at /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /build/python-sphinx-book-theme/src/sphinx_book_theme-1.0.0/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
error: js-build-failed

× The Javascript-based build pipeline failed.
╰─> See above for failure output from the underlying tooling.

link: https://sphinx-theme-builder.rtfd.io/errors/#js-build-failed

ERROR Backend subprocess exited when trying to invoke build_wheel

problem This is a major issue for downstream packaging, as it means that we can not safely package this project, which means we can not safely package a build system with which we build other things.

Reproduce the bug

local node_version="$(node --version | sed 's/v//')"
sed -E "s/(node-version = ).*/\1\"$node_version\"/" -i pyproject.toml
export STB_USE_SYSTEM_NODE=1
python -m build --wheel --no-isolation

List your environment

python 3.10.10
nodejs-lts-gallium 16.19.1
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

pradyunsg commented 1 year ago

See https://github.com/pradyunsg/sphinx-theme-builder/issues/32#issuecomment-1462125296

You're trying to build with an older version of NodeJS than this theme declares it needs.

dvzrv commented 1 year ago

No, it's the other way round. The theme wants 16.13.2 and I'm trying to build with 16.19.1 (system version). 🙃

-------- Original Message -------- From: Pradyun Gedam @.> Sent: March 9, 2023 3:07:20 PM GMT+01:00 To: executablebooks/sphinx-book-theme @.> Cc: David Runge @.>, Author @.> Subject: Re: [executablebooks/sphinx-book-theme] 1.0.0 unable to build with system node (Issue #706)

See https://github.com/pradyunsg/sphinx-theme-builder/issues/32#issuecomment-1462125296

You're trying to build with an older version of NodeJS than this theme declares it needs.

-- https://sleepmap.de