Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Cannot find module 'lib/axios' #221

Open
KareemDa opened this issue Oct 13, 2021 · 11 comments
Open

Cannot find module 'lib/axios' #221

KareemDa opened this issue Oct 13, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@KareemDa
Copy link

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:
image

@KareemDa KareemDa added the bug Something isn't working label Oct 13, 2021
@davestewart
Copy link

davestewart commented Oct 13, 2021

Just had the same. Seems to be an issue with 0.3.5.

Downgrading to 0.2x solves it for me.

@danielroe
Copy link
Member

Would you provide a reproduction? 🙏

@davestewart
Copy link

davestewart commented Oct 13, 2021

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

@davestewart
Copy link

Best I can do is a breakpoint in node_modules/resolve/lib/sync.js:

image

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...

@DengSihan
Copy link

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

@weshuiz
Copy link

weshuiz commented Nov 10, 2021

nuxt breaks the moment vite 0.3.5 gets added
have the same problem

@dan-online
Copy link

I also saw this with nuxt and vite 0.3.5, turns out having ssr:true was the issue

@JedediahXu
Copy link

目前还不进行修复吗.. 这个bug 我找了好久原因。。。

@shanks25
Copy link

do we have any update on this i tried to downgrade its showing loader only

image

@aminlotfi
Copy link

aminlotfi commented Jul 16, 2022

do we have any update on this i tried to downgrade its showing loader only

image

same problem :)
Can anybody give me some hint to handle it?

@davinma
Copy link

davinma commented Sep 26, 2022

Remove '@nuxtjs/axios' from modules looks fine for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants