簡體   English   中英

Nuxt.js 無法使用 auth 模塊啟動

[英]Nuxt.js fails to start up with auth module

npx create-nuxt-app client並進行設置。 運行npm run dev一切正常。

我使用npm install @nuxtjs/auth開始身份驗證設置

nuxt.config.js添加'@nuxtjs/auth'模塊

像這樣添加示例身份驗證策略

  auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: '/api/login', method: 'post' },
        },
        tokenRequired: false,
        tokenType: false
      }
    }
  },

添加示例 vue 商店並將其保存在store/index.js

export const state = () => ({
  counter: 0
})

export const mutations = {
  increment(state) {
    state.counter++
  }
}

我運行npm run dev ,所有內容都編譯並顯示 init 消息轉到http://localhost:3000/ 嘗試在瀏覽器中加載它,該URL在初始加載后繼續加載並且沒有結束。 節點進程開始使用 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

我嘗試從節點v10.15.3v12.18.3 ,結果相同。 來自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"
  }

npx create-nuxt-app --version顯示create-nuxt-app/3.2.0 linux-x64 node-v12.18.3 操作系統是 Solus 4.1 Fortitude。

這里出了什么問題? 如果這是一個已知錯誤,是否有有效的版本/解決方法?

設置baseURL下在愛可信財產nuxt.config.js解決我的問題:

  axios: {
    baseURL: '/'
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM