framework
framework copied to clipboard
H3Error: Cannot find package graphql
Environment
OS: Linux Node: v17.8.0 Nuxt: 3.0.0-rc.6 Package manager: npm Bilder: vite
Reproduction
Project for reproduction: nuxt-h3-error-cant-find-package-graphql
- Run: npm run build
- Run: npm run start
- Will open main page which automatially send graphql request to backend and receive 500 internal server error, which can be see in console
- Check terminal log with H3 Error (see Logs section)
Actual result: text on the main page - []
Expected result: text on the main page - ['test1', 'test2']
Describe the bug
Hi! I use graphql library (https://github.com/graphql/graphql-js) in my project, and when I build and run a project, I receive H3Error: Cannot find package, more detail message in the Logs secton.
Additional context
No response
Logs
Listening on http://0.0.0.0:3000/
[h3] [unhandled] H3Error: Cannot find package '/var/mywebsite/.output/server/node_modules/graphql/' imported from /var/mywebsite/.output/server/chunks/graphqlnuxt.mjs
at createError (file:///var/mywebsite/.output/server/node_modules/h3/dist/index.mjs:196:15)
at Server.nodeHandler (file:///var/mywebsite/.output/server/node_modules/h3/dist/index.mjs:386:21) {
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: 'Internal Server Error'
}
[nuxt] [request error] Cannot find package '/var/mywebsite/.output/server/node_modules/graphql/' imported from /var/mywebsite/.output/server/chunks/graphqlnuxt.mjs
at createError (./.output/server/node_modules/h3/dist/index.mjs:196:15)
at Server.nodeHandler (./.output/server/node_modules/h3/dist/index.mjs:386:21)
Would you provide a reproduction? 🙏
Yeah, please let me some time to prepare a repository
I updated the description of issue and added link to a reproduction project
@DreadIsBack i installed it locally and it works. I cant reproduce the bug.
Have your tried a fresh install ? rm -rf node_modules package-lock.json .output .nuxt
Tested with node v17.8
@CodeDredd This is pretty strange, I tried to do it three times, and each time I receive the error.
I'm facing a similar issue https://github.com/nuxt/framework/issues/6144
In my case the cause is, I'm trying to import from a typescript library module in my plugins/api.plugin.ts file.
Just leaving it here as it might be related. Still could not solve it till now
Fixed by updating to nuxt-rc.8 and reinstall all packages. I will close this issue. Thanks all.