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