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

issue with node v22.2.0 #930

Closed
jachsu opened this issue Jun 1, 2024 · 4 comments
Closed

issue with node v22.2.0 #930

jachsu opened this issue Jun 1, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jachsu
Copy link
Contributor

jachsu commented Jun 1, 2024

The issue:
Running yarn build gives
▲ Next.js 14.0.3

(node:86224) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)

SuccessCallbackError {
error: SyntaxError: Unexpected identifier 'assert'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
at callTranslator (node:internal/modules/esm/loader:430:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:436:30)
at ModuleJob._link (node:internal/modules/esm/module_job:106:19),
_tag: 'SuccessCallbackError',
toString: [Function (anonymous)],
[Symbol()]: {
error: SyntaxError: Unexpected identifier 'assert'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
at callTranslator (node:internal/modules/esm/loader:430:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:436:30)
at ModuleJob._link (node:internal/modules/esm/module_job:106:19)
},
[Symbol()]: [ 'error' ]
}
Creating an optimized production build .%

After reinstalling the node@18, the issue get solved and everything works fine.

@jachsu jachsu added the bug Something isn't working label Jun 1, 2024
@timlrx
Copy link
Owner

timlrx commented Jun 9, 2024

Unfortunately this seems to be an issue with one of the dependencies of Eslint. See the following posts for more context - ajv-validator/ajv#2343 and garycourt/uri-js#95. You can use node 18 / 20 or override uri-js as suggested in the other posts.

I will update the dev dependencies when the underlying packages are updated.

@lujunji4113
Copy link

It seems to be caused by the fact that assert is not supported in higher versions of Node.js. As the official documentation says: This feature was previously named "Import assertions", and using the assert keyword instead of with. Any uses in code of the prior assert keyword should be updated to use with instead. https://nodejs.org/docs/latest-v22.x/api/esm.html#import-attributes

@Saugatkafley
Copy link

This solved the issue

After reinstalling the node@18, the issue get solved and everything works fine.

@timlrx timlrx closed this as completed Aug 11, 2024
@aminblm
Copy link

aminblm commented Aug 12, 2024

I can confirm @Saugatkafley, this worked for me too. Nasty bug got me walking around my whole blog posts database. Thank you for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants