N
Nuxt2mo ago
Viridian

Strange error when trying to run dev mode on a fresh install

For some reason, I seem to be getting this error when trying to run dev mode on my fresh Nuxt installation. I only installed nuxthub:
ERROR The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer' 17:35:40

import { createNuxtDevServer } from './dev2.mjs';
^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:482:26)
at async runCommand$1 (/C:/Users/Moos/Documents/GitHub/portfolio/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.f8a4d1b7.mjs:1637:28)
at async runMain$1 (/C:/Users/Moos/Documents/GitHub/portfolio/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.f8a4d1b7.mjs:1777:7)



ERROR The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer'
ERROR The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer' 17:35:40

import { createNuxtDevServer } from './dev2.mjs';
^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:482:26)
at async runCommand$1 (/C:/Users/Moos/Documents/GitHub/portfolio/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.f8a4d1b7.mjs:1637:28)
at async runMain$1 (/C:/Users/Moos/Documents/GitHub/portfolio/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.f8a4d1b7.mjs:1777:7)



ERROR The requested module './dev2.mjs' does not provide an export named 'createNuxtDevServer'
Any idea what is going wrong here? It seems strange.
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @Viridian. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This error suggests there might be an issue with your Nuxt installation or configuration. Based on the knowledge sources provided, I can offer some insights and potential solutions: 1. The error indicates that the module './dev2.mjs' doesn't export 'createNuxtDevServer', which is unexpected for a fresh Nuxt installation. This could be due to a few reasons: 2. Incompatible versions: Make sure you're using compatible versions of Nuxt and its dependencies. The error message mentions [email protected], which is a recent version. Ensure all your packages are up to date. 3. Incomplete or corrupted installation: Try removing the node_modules folder and package-lock.json (or yarn.lock if using Yarn), then reinstall your dependencies. 4. ESM-related issues: Nuxt 3 uses ES Modules, which can sometimes cause issues. As mentioned in the ES Modules troubleshooting guide (https://nuxt.com/docs/guide/concepts/esm#troubleshooting-esm-issues), you might need to transpile certain libraries or alias them to their CommonJS versions if they're not properly supporting ESM. 5. Node.js version: Ensure you're using a compatible Node.js version. Nuxt 3 requires Node.js 14.16.0 or later, preferably the latest LTS version. To troubleshoot this issue, you can try the following steps: 1. Delete the .nuxt, node_modules, and .output directories, as well as the package-lock.json or yarn.lock file. 2. Ensure you're using the latest LTS version of Node.js. 3. Reinstall your dependencies with npm install or yarn install. 4. Try running the development server again with npm run dev or yarn dev. If the issue persists, you might want to check if there are any known issues with the nuxthub package you installed. It's possible that this package is causing conflicts with the core Nuxt functionality. If none of these steps resolve the issue, you may want to create a minimal reproduction of the problem and report it as a bug to the Nuxt GitHub repository (https://nuxt.com/docs/community/reporting-bugs#figure-out-what-the-cause-might-be). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@173158033742888961> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Viridian
ViridianOP2mo ago
Here's my package.json:
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxthub/core": "0.8.7",
"nuxt": "^3.14.1592",
"vue": "latest",
"vue-router": "latest"
}
}
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxthub/core": "0.8.7",
"nuxt": "^3.14.1592",
"vue": "latest",
"vue-router": "latest"
}
}
Solved it by doing a clean install... Weird.

Did you find this page helpful?