timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.64k stars 2.01k forks source link

issue with node v22.2.0 #930

Closed jachsu closed 1 month ago

jachsu commented 4 months ago

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)],

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.

timlrx commented 3 months ago

Unfortunately this seems to be an issue with one of the dependencies of Eslint. See the following posts for more context - https://github.com/ajv-validator/ajv/issues/2343 and https://github.com/garycourt/uri-js/pull/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 commented 3 months ago

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 commented 2 months ago

This solved the issue

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

aminblm commented 1 month ago

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.