Cannot find module 'lib/axios'
KareemDa opened this issue · 11 comments
Versions
nuxt-vite: 0.3.5
nuxt: 2.15.7
Reproduction
export default {
target: 'static',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {...},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'@/assets/styles/main.scss',
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: {
dirs: [
'~/components',
'~/components/elements/habit-fundementals',
'~/components/elements/prices-cards',
'~/components/elements/the-dividers',
]
},
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
'@nuxtjs/tailwindcss',
'nuxt-vite'
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: ['@nuxtjs/axios'],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},
}
Description
Building project is completing successfully. but when I try to load the page I'm getting the Error:
Just had the same. Seems to be an issue with 0.3.5.
Downgrading to 0.2x solves it for me.
Would you provide a reproduction? 🙏
Ah, going to be difficult on this project, but happy for you to screen share if you want to take a look
I'm on Nuxt 2.15.7 and Nuxt Vite 0.3.5 though
Best I can do is a breakpoint in node_modules/resolve/lib/sync.js
:
If I disable the module in config, it blows up again, with:
Cannot read property 'get' of undefined
Turns out this is actually an $axios.get()
in nuxtServerInit()
(good for me to track that down anyway!).
Note:
// error
Cannot find module 'lib/axios' from '/Volumes/Data/Work/Work/Finsbury/04_development/finsbury-news'
// config
'@nuxtjs/axios',
// axios path
node_modules/@nuxtjs/axios/lib
So there is no lib/axios
but there is axios/lib
...
same issue here
reproduction:
just add @nuxtjs/axios
and nuxt-vite
in a blank nuxt project
package.json
"@nuxtjs/axios": "^5.13.6",
"nuxt-vite": "^0.3.5",
downgrading to 0.2.4 solves it
nuxt breaks the moment vite 0.3.5 gets added
have the same problem
I also saw this with nuxt and vite 0.3.5, turns out having ssr:true
was the issue
目前还不进行修复吗.. 这个bug 我找了好久原因。。。
Remove '@nuxtjs/axios'
from modules
looks fine for me.