You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SyntaxError: Unexpected identifier 'assert' when using Node.js v22.0.0+ with ultracite
Description
When running npx ultracite with Node.js v22.0.0 and above, the following error is thrown:
file:///Users/ABCD/TEST//node_modules/.pnpm/[email protected]/node_modules/ultracite/scripts/run.mjs:5
import packageJson from '../package.json' assert { type: 'json' };
^^^^^^
SyntaxError: Unexpected identifier 'assert'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
at callTranslator (node:internal/modules/esm/loader:416:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:422:30)
at async link (node:internal/modules/esm/module_job:88:21)
Node.js v22.0.0
The same command works fine with earlier versions of Node.js (e.g., v18.x or v20.x or v21.x).
Steps to Reproduce
Install Node.js v22.0.0 (or any version >= v22.0.0).
Run the following command:
npx ultracite
Observe the error.
Expected Behavior
The npx ultracite command should run successfully without throwing a syntax error.
Actual Behavior
The command fails with a SyntaxError: Unexpected identifier 'assert' when attempting to import package.json using the assert { type: 'json' } syntax.
Environment
Node.js Version: v22.0.0
ultracite Version: 4.1.14
Operating System: macOS/Windows/Linux (mention your OS here)
========================================================
Date..............: 2024-12-29 05:32:14 PST
Installed Global Packages:
nvm : 0.40.1
node : v22.0.0
npm : 10.5.1
Node.js : v22.0.0
yarn :
pnpm : 9.15.0
bun : Not installed
corepack : 0.26.0
pm2 : 5.4.3
=== System Information ===
Hostname: 123.internal
OS: Darwin
Kernel Version: 24.2.0
Processor: arm
CPU Architecture: arm64
Memory: 184.734 GB
Disk Space: 1.3Ti
========================================================
Additional Information
The error seems to be related to the assert { type: 'json' } syntax used in the run.mjs file of the ultracite package.
This syntax works in Node.js v16.14.0 and above for most versions but appears to break in Node.js v22.0.0+.
The issue might be related to changes in the ECMAScript Module (ESM) implementation in Node.js v22.0.0.
Similar issues were encountered when attempting to use the GitHub repository: next-forge
The text was updated successfully, but these errors were encountered:
SyntaxError: Unexpected identifier 'assert' when using Node.js v22.0.0+ with ultracite
Description
When running
npx ultracite
with Node.js v22.0.0 and above, the following error is thrown:The same command works fine with earlier versions of Node.js (e.g., v18.x or v20.x or v21.x).
Steps to Reproduce
Expected Behavior
The
npx ultracite
command should run successfully without throwing a syntax error.Actual Behavior
The command fails with a
SyntaxError: Unexpected identifier 'assert'
when attempting to importpackage.json
using theassert { type: 'json' }
syntax.Environment
Additional Information
assert { type: 'json' }
syntax used in therun.mjs
file of theultracite
package.The text was updated successfully, but these errors were encountered: