Skip to content

Quire new command fails with newer version of Node #968

@tinykite

Description

@tinykite

Before proceeding, make sure there isn’t an existing issue for this bug.

  • I have searched the existing issues and determined this is a new bug.

Expected Behavior

I expected to be able to use the most recent node version with long-term-support with the quire CLI.

Actual Behavior

The command quire new test-project fail to run, and outputs the following command line error:

file:///Users/tinykite/.nvm/versions/node/v22.11.0/lib/node_modules/@thegetty/quire-cli/bin/cli.js:4
import packageConfig from '#root/package.json' assert { type: 'json' }
                                               ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:340:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:433:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27)
    at async ModuleJob._link (node:internal/modules/esm/module_job:112:19)
    
Node.js v22.11.0

Steps to Reproduce

Using nvm to manage node versions:

nvm install 22.11.0  
nvm use 22.11.0  
npm install -g @thegetty/quire-cli
quire new test-project     

Version Numbers

quire info --debug fails to run and outputs the same error:

file:///Users/tinykite/.nvm/versions/node/v22.11.0/lib/node_modules/@thegetty/quire-cli/bin/cli.js:4
import packageConfig from '#root/package.json' assert { type: 'json' }
                                               ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:340:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:433:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27)
    at async ModuleJob._link (node:internal/modules/esm/module_job:112:19)

Node.js v22.11.0

Web Browser

No response

Relevant Terminal/Shell Output

(Shown above)

Supporting Information

I wasn't familiar with what this error meant, so I went looking for specific updates to Node that would break the cli. As far as I understand, this seems to have happened in esm: drop support for import assertions. A PR had previously been merged to update documentation to reflect that developers should use import attributes rather than import assertions. This more recent update removes support for import assertions entirely.

From the pull request description:

This patch removes support for the assert keyword for import attributes. It was an old variant of the proposal that was only shipped in V8 and no other
engine, and that has then been replaced by the with keyword.

Chrome is planning to remove support for assert
in version 126, which will be released in June.

Node.js already supports the with keyword for
import attributes, and this patch does not change that.

The import attributes v8 documentation explains why import assertions have been deprecated, and how to fix it.

As far as I can tell, v8 now intends the assert keyword here:

import packageConfig from '#root/package.json' assert { type: 'json' }

To be replaced with with instead:

import packageConfig from '#root/package.json' with { type: 'json' };

Metadata

Metadata

Assignees

Labels

status:backlogIssue is a lower priority but needs to eventually be addressedstatus:triage neededIssue needs to be triaged by the Quire team. This label is automatically applied to new issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions