2

启动 NativeScript Sidekick 时,我收到来自 Windows 的异常,说明如下(此错误消息也显示在 Sidekick 中的输出错误中):(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.
4

1 回答 1

7

事实证明NativeScript Sidekick必须使用gulp 3

我在StackOverflow上找到了这个答案,讨论了一个类似的问题,但与 NativeScript Sidekick 无关。

必须确保您当前安装的节点版本不是12,因为节点 v12gulp 3不能一起工作,如您在此处看到的

要检查您的节点版本,请在终端中运行以下命令:

$ node -v

由于我们自己无法更改NativeScript Sidekick的gulp版本,因此最好的解决方案是降级 node 版本。

在撰写本文时,最新的LTS版本是10. 降级到此版本可解决异常错误消息。

于 2019-05-09T13:19:01.530 回答