簡體   English   中英

NX 無法讀取未定義的屬性(讀取“長度”)

[英]NX Cannot read properties of undefined (reading 'length')

我正在將 nx 用於一個項目,而我所擁有的只是一個 svelte kit 項目,未經改動,使用以下命令生成:

nx g @nxext/sveltekit:app dashboard

運行nx serve dashboard時出現此錯誤

 >  NX   Cannot read properties of undefined (reading 'length')


TypeError: Cannot read properties of undefined (reading 'length')
    at interpolateArgsIntoCommand (C:\Users\USER\Documents\Assassin\node_modules\nx\src\executors\run-commands\run-commands.impl.js:193:47)
    at C:\Users\USER\Documents\Assassin\node_modules\nx\src\executors\run-commands\run-commands.impl.js:106:21
    at Array.forEach (<anonymous>)
    at normalizeOptions (C:\Users\USER\Documents\Assassin\node_modules\nx\src\executors\run-commands\run-commands.impl.js:104:22)
    at C:\Users\USER\Documents\Assassin\node_modules\nx\src\executors\run-commands\run-commands.impl.js:41:28 
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\USER\Documents\Assassin\node_modules\tslib\tslib.js:115:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

 —————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target "dashboard:serve" failed

   Failed tasks:

   - dashboard:serve

   Hint: run the command with --verbose for more details.

“提示”也有點奇怪,因為我已經有了--verbose標志。

我很確定這只是 @nxext nx 插件已過時。 Svelte Kit 剛剛進入候選版本,但直到現在它的 API 變化很大。

您可以在 vanilla nx 中執行以下操作:

應用程序/myapp/project.json

{
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "name": "myapp",
  "sourceRoot": "packages/myapp/src",
  "targets": {
    "build": {
      "executor": "nx:run-script",
      "outputs": [
        "packages/myapp/.svelte-kit",
        "packages/myapp/build"
      ],
      "options": {
        "script": "build"
      }
    },
    "dev": {
      "executor": "nx:run-script",
      "outputs": [
        "packages/myapp/.svelte-kit"
      ],
      "options": {
        "script": "dev"
      }
    }
}

我想你知道,但沒有相應的 NX 目標只會運行同名的 npm 腳本

我喜歡使用 NX 目標(或自定義工作區插件)的唯一原因是您可以指定NX 緩存使用的輸出。

暫無
暫無

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

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