addAbortListener import broken on NuxtHub deployment

[log] [nuxi] Nuxt 3.15.4 with Nitro 2.10.4
19:18:55.348 [error] The requested module 'node:events' does not provide an export named 'addAbortListener'
19:18:55.349 import {addAbortListener} from 'node:events';
19:18:55.349 ^^^^^^^^^^^^^^^^
19:18:55.349 SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener'
19:18:55.349 at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
19:18:55.350 at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
[log] [nuxi] Nuxt 3.15.4 with Nitro 2.10.4
19:18:55.348 [error] The requested module 'node:events' does not provide an export named 'addAbortListener'
19:18:55.349 import {addAbortListener} from 'node:events';
19:18:55.349 ^^^^^^^^^^^^^^^^
19:18:55.349 SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener'
19:18:55.349 at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
19:18:55.350 at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
Constantly fighting with the above error in my nuxthub deployment. Worked fine before but after some package update (unfortunately I am unable to track down specifically which one), this error started occuring on every deployment. Tried changing the node.js version many times to many different versions with no avail. Can't find any answers online. Any ideas?
5 Replies
kapa.ai
kapa.ai2w ago
Hi @Josef Trojkař. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This error appears to be related to a compatibility issue between the Node.js version used in your NuxtHub deployment and the Nuxt version you're using. The addAbortListener function was introduced in Node.js v15.0.0, so it's possible that your deployment environment is using an older version of Node.js that doesn't support this feature. Here are a few suggestions to troubleshoot and potentially resolve this issue: 1. Check your Node.js version: Make sure you're using a Node.js version that supports addAbortListener. According to the Nuxt documentation, Nuxt 3 requires Node.js version 16.10 or higher. 2. Update your dependencies: There was a recent issue with the db0 package that caused problems with Nuxt initialization. As mentioned in a GitHub comment, this has been fixed in the latest version of db0. Try updating your dependencies to the latest versions, especially Nuxt and its related packages.
npm update
# or
yarn upgrade
# or
pnpm update

npm update
# or
yarn upgrade
# or
pnpm update

3. Clear cache and reinstall dependencies: Sometimes, clearing the cache and reinstalling dependencies can resolve issues:
npm cache clean --force
rm -rf node_modules
npm install

npm cache clean --force
rm -rf node_modules
npm install

4. Check your package.json: Ensure that your package.json file specifies the correct Node.js version in the engines field:
"engines": {
"node": ">=16.10.0"
}

"engines": {
"node": ">=16.10.0"
}

5. Contact NuxtHub support: If the issue persists after trying these steps, it might be related to the specific environment provided by NuxtHub. In this case, you should contact their support team for assistance. If none of these solutions work, you may need to investigate further by checking your application's code and dependencies for any recent changes that might have introduced this incompatibility. GitHub Issue: Broken init provides some context about recent issues with Nuxt initialization, which might be related to your problem. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@441620523831525387> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Josef Trojkař
Josef TrojkařOP2w ago
@kapa.ai i tried everything you suggested and more. I tried around 25 different node.js versions that are compatible and not a single one worked which leads me to believe the issue is somwhere else.
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I apologize that the previous suggestions didn't resolve your issue. You're right that if you've tried multiple Node.js versions without success, the problem likely lies elsewhere. Let's explore some other potential causes and solutions based on the information available in the knowledge sources. 1. Check for conflicting dependencies: The error you're seeing might be caused by a conflict between different versions of dependencies. You can try to identify and resolve these conflicts by running:
npm ls node:events

npm ls node:events

This will show you which packages are depending on node:events and their versions. 2. Investigate recent updates: As mentioned in the GitHub issue about a similar error, there have been recent changes in Nuxt that might be related to your problem. The issue was reportedly resolved in a nightly build. You could try using the nightly version of Nuxt to see if it resolves your issue:
npm install nuxt-nightly@3x

npm install nuxt-nightly@3x

3. Check for import protection issues: There have been recent changes to import protections in Nuxt. As mentioned in a GitHub pull request, a separate custodio library was introduced for import protections. Make sure you're using the latest version of Nuxt and its dependencies, which might include fixes for these issues. 4. Examine your Nuxt configuration: Review your nuxt.config.js file for any custom configurations that might be causing issues. Particularly, check if you have any custom build or alias configurations that could be interfering with the module resolution. 5. Create a minimal reproduction: If the issue persists, it would be helpful to create a minimal reproduction of the problem. As suggested in the Nuxt documentation on reporting bugs, try to reproduce the issue in a minimal Nuxt project. This can help isolate the problem and make it easier for the Nuxt team or the community to assist you. 6. Check for NuxtHub-specific issues: Since you're deploying on NuxtHub, there might be platform-specific issues. Check if there are any known issues or recent changes in NuxtHub that could be affecting your deployment. If none of these suggestions help, and given that you've already tried multiple Node.js versions, it might be worth opening a new issue on the Nuxt GitHub repository with a detailed description of your problem, including your package.json, nuxt.config.js, and a minimal reproduction if possible. The Nuxt team or community might be able to provide more specific guidance based on your particular setup. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@441620523831525387> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?