[英]Nuxt.js fails to start up with auth module
npx create-nuxt-app client
and set it up. npx create-nuxt-app client
并进行设置。 Run npm run dev
and everything works.运行npm run dev
一切正常。
I start auth setup with npm install @nuxtjs/auth
我使用npm install @nuxtjs/auth
开始身份验证设置
add '@nuxtjs/auth'
module in nuxt.config.js
在nuxt.config.js
添加'@nuxtjs/auth'
模块
add example auth strategy like so像这样添加示例身份验证策略
auth: {
strategies: {
local: {
endpoints: {
login: { url: '/api/login', method: 'post' },
},
tokenRequired: false,
tokenType: false
}
}
},
Add the example vue store and save it in store/index.js
:添加示例 vue 商店并将其保存在store/index.js
:
export const state = () => ({
counter: 0
})
export const mutations = {
increment(state) {
state.counter++
}
}
I run npm run dev
, everything compiles and init message shows to go to http://localhost:3000/
.我运行npm run dev
,所有内容都编译并显示 init 消息转到http://localhost:3000/
。 Trying to load it in the browser, the URL continues to load after initial loading and does not end.尝试在浏览器中加载它,该URL在初始加载后继续加载并且没有结束。 Node process starts to use 100% of the CPU and after several minutes prints this and quits:节点进程开始使用 100% 的 CPU,几分钟后打印并退出:
<--- Last few GCs --->
[34438:0x38ef0c0] 323677 ms: Scavenge 2003.9 (2048.6) -> 2003.2 (2049.1) MB, 10.9 / 0.0 ms (average mu = 0.209, current mu = 0.192) allocation failure
[34438:0x38ef0c0] 323728 ms: Scavenge 2004.6 (2049.6) -> 2004.0 (2049.9) MB, 12.4 / 0.0 ms (average mu = 0.209, current mu = 0.192) allocation failure
[34438:0x38ef0c0] 323778 ms: Scavenge 2005.4 (2050.4) -> 2004.8 (2050.6) MB, 10.9 / 0.0 ms (average mu = 0.209, current mu = 0.192) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x13cf019]
Security context: 0x29f654d808d1 <JSObject>
1: inspect(aka inspect) [0x32d8b34ca9f9] [internal/util/inspect.js:~240] [pc=0xee1e7f4f44c](this=0x1cbf81fc04b1 <undefined>,0x29f654d98bc1 <JSFunction Boolean (sfi = 0x3f35983d3769)>,0x02b5724d8a71 <Object map = 0x1bc8fcdd6919>)
2: /* anonymous */ [0x9a2eaaec139] [/home/myUserName/Documents/projectFile/client/node_modules/esm/esm.js:~1] [pc=0xee1e7e6e063](...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa093f0 node::Abort() [node]
2: 0xa097fc node::OnFatalError(char const*, char const*) [node]
3: 0xb842ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb84629 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd30fe5 [node]
6: 0xd31676 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xd3def5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xd3eda5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xd4185c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd0830b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
11: 0x1049f4e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x13cf019 [node]
Aborted
I tried this start to finish with node v10.15.3
and v12.18.3
, the same result.我尝试从节点v10.15.3
和v12.18.3
,结果相同。 Versions from package.json
:来自package.json
版本:
"dependencies": {
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.0",
"bootstrap": "^4.5.0",
"bootstrap-vue": "^2.15.0",
"nuxt": "^2.14.0"
}
and npx create-nuxt-app --version
shows create-nuxt-app/3.2.0 linux-x64 node-v12.18.3
.和npx create-nuxt-app --version
显示create-nuxt-app/3.2.0 linux-x64 node-v12.18.3
。 OS is Solus 4.1 Fortitude.操作系统是 Solus 4.1 Fortitude。
What is going wrong here?这里出了什么问题? If this is a known bug, are there versions/workaround that works?如果这是一个已知错误,是否有有效的版本/解决方法?
Setting baseURL
property under for axios in nuxt.config.js
solved my issue:设置baseURL
下在爱可信财产nuxt.config.js
解决我的问题:
axios: {
baseURL: '/'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.