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

Release 4.2 breaks support for node 18 adding a dependency which requires node 20 #181

Open
Evertvdw opened this issue Jan 9, 2025 · 9 comments · May be fixed by #183
Open

Release 4.2 breaks support for node 18 adding a dependency which requires node 20 #181

Evertvdw opened this issue Jan 9, 2025 · 9 comments · May be fixed by #183

Comments

@Evertvdw
Copy link

Evertvdw commented Jan 9, 2025

I just noticed our build pipelines failing which used node 18. When investigating the issue I found that this was dus to this error:

error [email protected]: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.20.5"

Digging deeper this package is introduced as a new dependency in the @asamuzakjp/css-color package that is added, as the npm list output shows:

 [email protected]
      └─┬ @asamuzakjp/[email protected]
        └── [email protected]
@heidfeld
Copy link

heidfeld commented Jan 9, 2025

There are also problems with jest tests in our project after 4.2 cssstyle release.

    SyntaxError: Unexpected token 'export'
      1 | const crypto = require('crypto');
      2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
    > 3 | const {JSDOM} = require('jsdom');
        |                 ^
      4 |
      5 | const POLICIES_TYPE = {
      6 |     SCRIPT_SRC: 'script-src',
      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
      at Object.<anonymous> (node_modules/cssstyle/lib/parsers.js:7:39)
      at Object.<anonymous> (node_modules/cssstyle/lib/CSSStyleDeclaration.js:10:29)
      at Object.<anonymous> (node_modules/jsdom/lib/jsdom/browser/Window.js:4:33)
      at Object.<anonymous> (node_modules/jsdom/lib/api.js:13:26)
Test suite failed to run
    Jest encountered an unexpected token
    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
    By default "node_modules" folder is ignored by transformers.
    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation
    Details:
    /builds/my-project/node_modules/@asamuzakjp/css-color/dist/esm/css-color.min.js:1

@Bladesheng
Copy link

Bladesheng commented Jan 9, 2025

There are also problems with jest tests in our project after 4.2 cssstyle release.

Similar problem with [email protected] + [email protected] which pulls in [email protected] Works fine when i manually downgrade the version to [email protected] in lockfile

⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
Error: require() of ES Module /xxx/node_modules/.pnpm/@[email protected]/node_modules/@asamuzakjp/css-color/dist/esm/css-color.min.js from /xxx/node_modules/.pnpm/[email protected]/node_modules/cssstyle/lib/parsers.js not supported.
Instead change the require of css-color.min.js in /xxx/node_modules/.pnpm/[email protected]/node_modules/cssstyle/lib/parsers.js to a dynamic import() which is available in all CommonJS modules.
 ❯ TracingChannel.traceSync node:diagnostics_channel:315:14
 ❯ Object.<anonymous> node_modules/.pnpm/[email protected]/node_modules/cssstyle/lib/parsers.js:7:39
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

@consultor5aluiz
Copy link

Same here, someone can depreciate that version?

@asamuzaK
Copy link
Contributor

asamuzaK commented Jan 9, 2025

Filed asamuzaK/cssColor#36
Please follow there.
Sorry for inconvenience.

@domenic
Copy link
Member

domenic commented Jan 10, 2025

I don't understand how our CI passed. https://github.com/jsdom/cssstyle/actions/runs/12684004933/job/35351997644 shows

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '[email protected]',
npm warn EBADENGINE   required: { node: '20 || >=22' },
npm warn EBADENGINE   current: { node: 'v18.20.5', npm: '10.8.2' }
npm warn EBADENGINE }

Why is this only a warning for our CI, and an error for your environment?

@asamuzaK
Copy link
Contributor

asamuzaK commented Jan 10, 2025

Why is this only a warning for our CI, and an error for your environment?

Ref: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#engines

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

Ref: https://docs.npmjs.com/cli/v11/using-npm/config#engine-strict

If set to true, then npm will stubbornly refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.

@domenic
Copy link
Member

domenic commented Jan 10, 2025

I guess we should probably set that flag in jsdom's CI, at least...

domenic added a commit to jsdom/jsdom that referenced this issue Jan 10, 2025
This would prevent future occurrences like jsdom/cssstyle#181.

Also tidy up the CI file a bit, and fix a missed update to package-lock.json.
@asamuzaK
Copy link
Contributor

Pre-published a beta version for testing.
asamuzaK/cssColor#36 (comment)
Test with it and see if it works as expected.

Please give a feedback there, not here.
Thanks.

@zachCompass
Copy link

zachCompass commented Jan 14, 2025

@asamuzaK Can we get the fix you released in css-color migrated upward to this repo for testing? I personally appreciate your quick turn around on this. Hoping to see it updated in jsdom soon! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants