New nuxt app, cannot find module vitest/config
I am trying to create a new nuxt app from scratch with @nuxt/test-utils installed but I can't even run the dev server because I get the following error:
"Cannot start nuxt: Error while importing module @nuxt/test-utils: Error: Cannot find module 'vitest/config' nuxi 8:02:41 PM"
I have tried using both npm and pnpm with no different result
8 Replies
Hi @AlexBogues. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error "Cannot find module 'vitest/config'" when starting a new Nuxt app with @nuxt/test-utils indicates that the vitest package is missing from your project's dependencies. According to the official Nuxt documentation, when setting up testing with @nuxt/test-utils, you must explicitly install vitest as a dev dependency, as it is an optional peer dependency and not installed automatically.
To resolve this, install the required dependencies using one of the following commands (depending on your package manager):
After installing these, you should be able to run your Nuxt app and use the test utilities without encountering the "Cannot find module 'vitest/config'" error. If you are only doing unit testing and not using playwright, you can omit playwright-core from the install command.
For more details, see the Nuxt testing documentation: Nuxt Testing - Installation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@179722310821871616> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Now i get this issue with pnpm sql lite Cannot start nuxt: Could not locate the bindings file. Tried:
@kapa.ai Now I get this issue with pnpm Now i get this issue with pnpm sql lite Cannot start nuxt: Could not locate the bindings file. Tried: better-sqlite
Let me check the knowledge base for you again. One moment! :books:
----------------------
The error "Could not locate the bindings file. Tried: better-sqlite" when using pnpm with Nuxt typically means that the native bindings for the better-sqlite3 package are missing or not properly installed. This can happen due to issues with how pnpm handles native dependencies, especially in monorepos or when node_modules are hoisted.
Recommended solutions from the knowledge sources:
1. Install sqlite3 or better-sqlite3 explicitly
For Nuxt Content, you should install the sqlite3 package in your project if you are deploying to environments like AWS Amplify, but for local development or most server environments, better-sqlite3 is used by default. Make sure it is installed: 2. Check your environment
If you are deploying to a server, ensure your OS supports the required native bindings. For example, better-sqlite3 requires Glibc version higher than 2.29 (e.g., Debian 11, Ubuntu 20.04) when running on Node.js. You can check your Glibc version with: Server Hosting - Environment requirement 3. Clean and reinstall dependencies
Sometimes, pnpm's node_modules structure can cause issues with native modules. Try cleaning and reinstalling: 4. If using Node.js v22.5.0 or above, try native SQLite
Nuxt Content supports using the native node:sqlite module in Node.js v22.5.0 and above. Enable it in your config: Nuxt Content configuration - experimental.nativeSqlite 5. If deploying to AWS Amplify
You must install the sqlite3 package, as that's what Nuxt Content expects in that environment.
Deploy to AWS Amplify If you continue to have issues, try deleting node_modules and the lockfile, then reinstall: If none of these steps resolve the issue, please provide more details about your environment and deployment target, as the knowledge sources do not mention other specific solutions for this error. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
For Nuxt Content, you should install the sqlite3 package in your project if you are deploying to environments like AWS Amplify, but for local development or most server environments, better-sqlite3 is used by default. Make sure it is installed: 2. Check your environment
If you are deploying to a server, ensure your OS supports the required native bindings. For example, better-sqlite3 requires Glibc version higher than 2.29 (e.g., Debian 11, Ubuntu 20.04) when running on Node.js. You can check your Glibc version with: Server Hosting - Environment requirement 3. Clean and reinstall dependencies
Sometimes, pnpm's node_modules structure can cause issues with native modules. Try cleaning and reinstalling: 4. If using Node.js v22.5.0 or above, try native SQLite
Nuxt Content supports using the native node:sqlite module in Node.js v22.5.0 and above. Enable it in your config: Nuxt Content configuration - experimental.nativeSqlite 5. If deploying to AWS Amplify
You must install the sqlite3 package, as that's what Nuxt Content expects in that environment.
Deploy to AWS Amplify If you continue to have issues, try deleting node_modules and the lockfile, then reinstall: If none of these steps resolve the issue, please provide more details about your environment and deployment target, as the knowledge sources do not mention other specific solutions for this error. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@179722310821871616> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai EPERM: operation not permitted, unlink 'C:\Code\Hirameki\Hirameki_UI\node_modules.pnpm@unrs+resolver-binding-win32-x64-msvc@1.7.2\node_modules@unrs\resolver-binding-win32-x64-msvc\resolver.win32-x64-msvc.node'
Let me check the knowledge base for you again. One moment! :books:
----------------------
I'm sorry, but the knowledge sources provided do not contain information about the specific "EPERM: operation not permitted, unlink" error related to the @unrs/resolver-binding-win32-x64-msvc package or how to resolve it in a Nuxt project. This error appears to be related to file system permissions or issues with native bindings on Windows, but there is no explicit mention or solution for this scenario in the available Nuxt documentation or GitHub issues. If you need further assistance, you may want to search for this error in the Nuxt or related package repositories, or check your system's file permissions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@179722310821871616> Kapa.ai is still learning and improving, please let me know how I did by reacting below.