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

devtools relies on execa, which requires node 20+ #821

Closed
MickL opened this issue Mar 8, 2025 · 4 comments
Closed

devtools relies on execa, which requires node 20+ #821

MickL opened this issue Mar 8, 2025 · 4 comments

Comments

@MickL
Copy link

MickL commented Mar 8, 2025

Environment

With 3.16.0 I am getting the following error with a blank project created with bun create nuxt, as well as with all of my in-production projects:

	[error] The requested module 'node:events' does not provide an export named 'addAbortListener'
	  import {addAbortListener} from 'node:events';
	  ^^^^^^^^^^^^^^^^

Reproduction

https://github.com/MickL/nuxt-cloudflare
(this is a blank project created with bun create nuxt)

Cloudflare logs with Bun:

2025-03-08T22:20:09.118331ZCloning repository...
2025-03-08T22:20:09.707574ZFrom https://github.com/MickL/nuxt-cloudflare
2025-03-08T22:20:09.708324Z * branch            ce126b561539978d20fc2525535eac8a62c2aed2 -> FETCH_HEAD
2025-03-08T22:20:09.708475Z
2025-03-08T22:20:09.733332ZHEAD is now at ce126b5 packageManager was missing
2025-03-08T22:20:09.733846Z
2025-03-08T22:20:09.812942Z
2025-03-08T22:20:09.813448ZUsing v2 root directory strategy
2025-03-08T22:20:09.836259ZSuccess: Finished cloning repository files
2025-03-08T22:20:11.404792ZChecking for configuration in a Wrangler configuration file (BETA)
2025-03-08T22:20:11.405507Z
2025-03-08T22:20:12.503965ZNo wrangler.toml file found. Continuing.
2025-03-08T22:20:12.568802ZDetected the following tools from environment: bun@1.2.4, nodejs@18.17.1
2025-03-08T22:20:12.569298ZInstalling bun 1.2.4
2025-03-08T22:20:12.695595ZDownloading Bun v1.2.4...
2025-03-08T22:20:13.85174ZArchive:  /tmp/asdf-bun.v0iz/bun.zip
2025-03-08T22:20:14.612071Z  inflating: /opt/buildhome/.asdf/downloads/bun/1.2.4/bun  
2025-03-08T22:20:14.668693ZInstalling Bun v1.2.4...
2025-03-08T22:20:14.765439ZBun v1.2.4 is installed successfully!
2025-03-08T22:20:15.234695ZExecuting user command: bun install && bun run build
2025-03-08T22:20:15.455892Zbun install v1.2.4 (fd9a5ea6)
2025-03-08T22:20:16.741712Z
2025-03-08T22:20:16.741956Z$ nuxt prepare
2025-03-08T22:20:18.216647Z[error] The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:20:18.216944Z  import {addAbortListener} from 'node:events';
2025-03-08T22:20:18.217083Z  ^^^^^^^^^^^^^^^^
2025-03-08T22:20:18.21726Z  SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:20:18.217403Z  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
2025-03-08T22:20:18.217521Z  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5) 
2025-03-08T22:20:18.21765Z
2025-03-08T22:20:18.217763Z[error] The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:20:18.226734Zerror: postinstall script from "nuxt-app" exited with 1
2025-03-08T22:20:18.234945ZFailed: Error while executing user command. Exited with error code: 1
2025-03-08T22:20:18.24625ZFailed: build command exited with code: 1
2025-03-08T22:20:18.984597ZFailed: error occurred while running build command

Cloudflare logs with NPM:

2025-03-08T22:17:51.345154Z	Cloning repository...
2025-03-08T22:17:52.096348Z	From https://github.com/MickL/nuxt-cloudflare
2025-03-08T22:17:52.096837Z	 * branch            f5c9ff5c67a8245418955b507c5c7d58676995a9 -> FETCH_HEAD
2025-03-08T22:17:52.096948Z	
2025-03-08T22:17:52.125865Z	HEAD is now at f5c9ff5 first commit
2025-03-08T22:17:52.126717Z	
2025-03-08T22:17:52.216649Z	
2025-03-08T22:17:52.217664Z	Using v2 root directory strategy
2025-03-08T22:17:52.242976Z	Success: Finished cloning repository files
2025-03-08T22:17:53.859687Z	Checking for configuration in a Wrangler configuration file (BETA)
2025-03-08T22:17:53.860761Z	
2025-03-08T22:17:54.978701Z	No wrangler.toml file found. Continuing.
2025-03-08T22:17:55.047327Z	Detected the following tools from environment: npm@9.6.7, nodejs@18.17.1
2025-03-08T22:17:55.047873Z	Installing project dependencies: npm install --progress=false
2025-03-08T22:18:13.153504Z	npm WARN EBADENGINE Unsupported engine {
2025-03-08T22:18:13.153802Z	npm WARN EBADENGINE   package: 'execa@9.5.2',
2025-03-08T22:18:13.154003Z	npm WARN EBADENGINE   required: { node: '^18.19.0 || >=20.5.0' },
2025-03-08T22:18:13.154172Z	npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '9.6.7' }
2025-03-08T22:18:13.154323Z	npm WARN EBADENGINE }
2025-03-08T22:18:13.155363Z	npm WARN EBADENGINE Unsupported engine {
2025-03-08T22:18:13.155596Z	npm WARN EBADENGINE   package: 'human-signals@8.0.0',
2025-03-08T22:18:13.155742Z	npm WARN EBADENGINE   required: { node: '>=18.18.0' },
2025-03-08T22:18:13.15586Z	npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '9.6.7' }
2025-03-08T22:18:13.155975Z	npm WARN EBADENGINE }
2025-03-08T22:18:20.164527Z	
2025-03-08T22:18:20.172148Z	> postinstall
2025-03-08T22:18:20.172588Z	> nuxt prepare
2025-03-08T22:18:20.178468Z	
2025-03-08T22:18:21.79864Z	[error] The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:18:21.798956Z	  import {addAbortListener} from 'node:events';
2025-03-08T22:18:21.799159Z	  ^^^^^^^^^^^^^^^^
2025-03-08T22:18:21.799272Z	  SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:18:21.799406Z	  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
2025-03-08T22:18:21.799574Z	  at async ModuleJob.run (node:internal/modules/esm/module_job:190:5) 
2025-03-08T22:18:21.799691Z	
2025-03-08T22:18:21.799802Z	[error] The requested module 'node:events' does not provide an export named 'addAbortListener'
2025-03-08T22:18:21.822308Z	npm ERR! code 1
2025-03-08T22:18:21.822784Z	npm ERR! path /opt/buildhome/repo
2025-03-08T22:18:21.825756Z	npm ERR! command failed
2025-03-08T22:18:21.826078Z	npm ERR! command sh -c nuxt prepare
2025-03-08T22:18:21.828713Z	
2025-03-08T22:18:21.828913Z	npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2025-03-08T22_17_55_783Z-debug-0.log
2025-03-08T22:18:21.865811Z	Error: Exit with error code: 1
2025-03-08T22:18:21.866116Z	    at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
2025-03-08T22:18:21.866292Z	    at Object.onceWrapper (node:events:652:26)
2025-03-08T22:18:21.86644Z	    at ChildProcess.emit (node:events:537:28)
2025-03-08T22:18:21.866595Z	    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2025-03-08T22:18:21.884897Z	Failed: build command exited with code: 1
2025-03-08T22:18:22.642777Z	Failed: error occurred while running build command
Copy link

github-actions bot commented Mar 8, 2025

Stackblitz link for the reproduction: Stackblitz

@pi0
Copy link
Member

pi0 commented Mar 8, 2025

Some investigation:

It is an incompatibility with outdated Node.js 18 from cloudflare pages CI (nodejs@18.17.1) that lacks export (used by execa in nuxt applications)

execa used by @nuxt/devtools-kit /cc @antfu maybe it can migrate to tiny-exec?

@MickL
Copy link
Author

MickL commented Mar 8, 2025

Workaround for now: You can either create a file .nvmrc in your root OR add an env variable NODE_VERSION with the content v20 or v22 (latest LTS)

@pi0 pi0 changed the title Nuxt 3.16.0 - Cloudflare Pages: The requested module 'node:events' does not provide an export named 'addAbortListener' Nuxt 3.16.0 issue with Node.js 18.17.1 (cloudflare pages CI) Mar 8, 2025
@danielroe danielroe transferred this issue from nuxt/nuxt Mar 19, 2025
@danielroe danielroe changed the title Nuxt 3.16.0 issue with Node.js 18.17.1 (cloudflare pages CI) devtools relies on execa, which requires node 20+ Mar 19, 2025
@antfu
Copy link
Member

antfu commented Mar 20, 2025

Oh sorry for the troubles, I will downgrade the execa than. While I'd love to migrate to tinyexec, unfortunately, that execa is part of our public API for modules, and tinyexec is not compatible with that.

@antfu antfu closed this as completed in f15c7dc Mar 20, 2025
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

No branches or pull requests

3 participants