N
Nuxt3d ago
bnason

Nuxt prepack weird error

I'm getting a weird error when running npm run release in my project. It seems to be coming from npm run prepack but if I run that directly it works fine! It's only as part of the multi command release.
[12:46:04 PM] ERROR Cannot find module /github.com/nasontech/nuxt-fetch-transforms/dist/runtime/github imported from file:///github.com/nasontech/nuxt-fetch-transforms, file:///github.com/nasontech/, file:///github.com/nasontech/nuxt-fetch-transforms/_index.js, file:///github.com/nasontech/node_modules

at _resolve (node_modules/mlly/dist/index.mjs:2102:19)
at resolveSync (node_modules/mlly/dist/index.mjs:2111:10)
at resolvePathSync (node_modules/mlly/dist/index.mjs:2121:24)
at resolvePath (node_modules/mlly/dist/index.mjs:2125:28)
at Object.resolveId (node_modules/@nuxt/module-builder/dist/chunks/build.mjs:108:40)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
at async resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24117:26)
at async ModuleLoader.resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24531:15)
at async Object.resolveId (node_modules/unbuild/node_modules/@rollup/plugin-commonjs/dist/es/index.js:588:10)
[12:46:04 PM] ERROR Cannot find module /github.com/nasontech/nuxt-fetch-transforms/dist/runtime/github imported from file:///github.com/nasontech/nuxt-fetch-transforms, file:///github.com/nasontech/, file:///github.com/nasontech/nuxt-fetch-transforms/_index.js, file:///github.com/nasontech/node_modules

at _resolve (node_modules/mlly/dist/index.mjs:2102:19)
at resolveSync (node_modules/mlly/dist/index.mjs:2111:10)
at resolvePathSync (node_modules/mlly/dist/index.mjs:2121:24)
at resolvePath (node_modules/mlly/dist/index.mjs:2125:28)
at Object.resolveId (node_modules/@nuxt/module-builder/dist/chunks/build.mjs:108:40)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
at async resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24117:26)
at async ModuleLoader.resolveId (node_modules/unbuild/node_modules/rollup/dist/es/shared/node-entry.js:24531:15)
at async Object.resolveId (node_modules/unbuild/node_modules/@rollup/plugin-commonjs/dist/es/index.js:588:10)
3 Replies
kapa.ai
kapa.ai3d ago
Hi @bnason. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I don't have enough specific details to directly address the error you're encountering with npm run release and npm run prepack. However, I can provide some general insights and suggestions based on similar issues reported in Nuxt projects. The error message suggests that there's a problem resolving a module path, specifically related to /github.com/nasontech/nuxt-fetch-transforms/dist/runtime/github. This type of error can occur due to various reasons, including: 1. Module resolution issues 2. Incompatibilities between dependencies 3. Build process problems Here are a few suggestions that might help: 1. Check your project's dependencies: Make sure all your dependencies are up-to-date and compatible with each other. You might want to review your package.json file and consider updating packages if needed. 2. Clear cache and reinstall dependencies: Try clearing your npm cache and reinstalling dependencies:
npm cache clean --force
rm -rf node_modules
npm install

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

3. Check for ESM compatibility: As mentioned in the Nuxt documentation on ES Modules, some libraries might have issues with ESM imports. You could try adding the problematic module to the build.transpile config in your nuxt.config.js:
export default defineNuxtConfig({
build: {
transpile: ['nuxt-fetch-transforms']
}
})

export default defineNuxtConfig({
build: {
transpile: ['nuxt-fetch-transforms']
}
})

4. Investigate the build process: The error seems to occur during the build process. You might want to review your build scripts and ensure they're correctly configured. 5. Check for path issues: The error message mentions GitHub paths. Ensure that your project structure and import paths are correct, especially if you're working with local modules or GitHub repositories. If these general suggestions don't resolve the issue, you might need to provide more details about your project structure, package.json, and the exact commands in your release script. Consider opening an issue on the Nuxt GitHub repository with a minimal reproduction of the problem if it persists. Nuxt GitHub Issues is a good place to check for similar problems or to report a new issue if needed. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@712351223482810390> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
bnason
bnasonOP2d ago
Here is my repo, i'm still getting this error and can't for the life of me figure out why. https://github.com/NasonTech/nuxt-fetch-transforms
GitHub
GitHub - NasonTech/nuxt-fetch-transforms
Contribute to NasonTech/nuxt-fetch-transforms development by creating an account on GitHub.

Did you find this page helpful?