-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt3: serialize is not defined #560
Comments
Getting same issue -
|
same issue
|
First time using Nuxt 3, same issue. My Config: // nuxt.config.ts
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: [
'@nuxtjs/axios',
'@nuxtjs/auth-next'
],
router: {
middleware: ['auth']
},
auth: {
strategies: {
google: {
clientId: '...'
},
}
}
}) // tsconfig.json
{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"types": [
"@nuxtjs/auth-next",
]
},
} Error:
|
I've got the same problem with // nuxt.config.js
import { defineNuxtConfig } from "nuxt3";
export default defineNuxtConfig({
env: {
baseUrl,
},
axios: {
proxy: true,
},
proxy: {
"/api": {
target: baseUrl,
pathRewrite: { "^/api/": "api/" },
},
},
modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],
}) My solutionIt's helped to add modules: [["@nuxtjs/axios", { proxyHeaders: false }], "@nuxtjs/proxy"], and also publicRuntimeConfig: {
axios: {
baseURL: baseUrl,
},
},
modules: [["@nuxtjs/axios", { proxyHeaders: false }], "@nuxtjs/proxy"], |
shoot I am having the same issue as well yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
$ nuxt prepare
Nuxi 3.0.0-rc.9 18:14:54
ERROR Error compiling template: { 18:14:58
src: 'D:\\Projects\\_PersonalProjects\\Believers Sword Project\\believers-sword-web-new\\node_modules\\@nuxtjs\\axios\\lib\\plugin.js',
fileName: 'axios.js',
options: {
baseURL: 'http://localhost:3000/',
browserBaseURL: 'http://localhost:3000/',
credentials: false,
debug: false,
progress: true,
proxyHeaders: true,
proxyHeadersIgnore: [
'accept',
'cf-connecting-ip',
'cf-ray',
'content-length',
'content-md5',
'content-type',
'host',
'x-forwarded-host',
'x-forwarded-port',
'x-forwarded-proto'
],
proxy: false,
retry: false,
https: false,
headers: {
common: [Object],
delete: {},
get: {},
head: {},
post: {},
put: {},
patch: {}
},
globalName: 'nuxt'
},
filename: 'axios.js',
dst: 'D:/Projects/_PersonalProjects/Believers Sword Project/believers-sword-web-new/.nuxt/axios.js'
}
ERROR serialize is not defined 18:14:58
at eval (eval at <anonymous> (node_modules\lodash.template\index.js:1550:12), <anonymous>:52:1)
at compileTemplate (/D:/Projects/_PersonalProjects/Believers%20Sword%20Project/believers-sword-web-new/node_modules/@nuxt/kit/dist/index.mjs:558:45)
at async /D:/Projects/_PersonalProjects/Believers%20Sword%20Project/believers-sword-web-new/node_modules/nuxt/dist/index.mjs:1841:22
at async Promise.all (index 16)
at async generateApp (/D:/Projects/_PersonalProjects/Believers%20Sword%20Project/believers-sword-web-new/node_modules/nuxt/dist/index.mjs:1840:3)
at async _applyPromised (/D:/Projects/_PersonalProjects/Believers%20Sword%20Project/believers-sword-web-new/node_modules/perfect-debounce/dist/index.mjs:54:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. |
And added this to my nuxt.config.ts: Gave me this error:
|
I am having the same issue in a fresh nuxt 3 installation. Just added @nuxtjs/axios. Here is a minimal repro: https://stackblitz.com/edit/nuxt-starter-9xp8kl?file=nuxt.config.ts,package.json |
This allowed it to run without errors, but it is causing an error when accessing the actual 'http://localhost:3000'. |
Can reproduce with
my nuxt config: // https://v3.nuxtjs.org/api/configuration/nuxt.config
import { defineNuxtConfig } from "nuxt/config";
export default defineNuxtConfig({
target: "static",
nitro: {
preset: "nitro-prerender",
},
css: ["@/assets/main.css"],
buildModules: ["@nuxtjs/google-analytics"],
googleAnalytics: {
id: 'G-VL2J918CLL'
}
}); |
I also get the same error.
How to fix this ??? |
anyone who meet following #560 (comment) same kind error. HERE SOME TRICKS #536 (comment) which resolved by @bcspragu
then use them in your vue files
HERE #561 (comment) SOME OPTIONAL WAY if you want to use
AND FINALLY WE DO THE TRICKS
HORRAY |
wtf nuxt |
What's happening
Axios does not seem to work with Nuxt3.
Anytime a build is run, it will fail because of an undefined field.
Steps to reproduce
npm add @nuxtjs/axios
nuxt.config.js
npm run build
Output
Here is an issue that might be related: #536.
The text was updated successfully, but these errors were encountered: