启动NativeScript Sidekick时,我从Windows出现了一个异常,指出以下内容(该错误消息也显示在Sidekick的输出Errors中):UnhandledPromiseRejectionWarning: ReferenceError: primordials is not defined
(为了更容易阅读该错误的完整堆栈跟踪,请参见底部)
除了安装NativeScript Sidekick并打开应用程序外,我什么都没做。
我该如何解决这个问题?
(CLI) (node:6632) UnhandledPromiseRejectionWarning: ReferenceError: primordials is not defined
at fs.js:27:35
at req_ (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:143:24)
at Object.req [as require] (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:55:10)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at emitWarning (internal/process/promises.js:120:15)
at processPromiseRejections (internal/process/promises.js:168:7)
at processTicksAndRejections (internal/process/task_queues.js:90:32)
(node:6632) ReferenceError: primordials is not defined
at fs.js:27:35
at req_ (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:143:24)
at Object.req [as require] (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:55:10)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
来自控制台的更多信息:
NativeScript Sidekick version: 1.16.2-v.2019.3.13.12
Dependencies versions: NodeJS: 12.1.0, npm: 6.4.1, NativeScript CLI: 5.3.4.
最佳答案
事实证明, NativeScript Sidekick 必须使用 gulp 3 。
我在StackOverflow上找到了一个类似问题的答案,但与NativeScript Sidekick无关。
必须确保您当前安装的节点版本不是 12 ,因为节点v12 和 gulp 3 不能一起工作,因为您可以看到here
要检查您的节点版本,请在终端中运行以下命令:
$ node -v
由于我们无法自行更改的的 gulp 版本,因此最好的解决方案是降级节点版本。
在撰写本文时,最新的 LTS 版本是
10
。降级到此版本可解决异常错误消息。