简体   繁体   English

如何修复 ReferenceError: primordials 未在节点 v13.12.0 中定义

[英]How to fix ReferenceError: primordials is not defined in node v13.12.0

I am trying to install krakenjs using the guide available on http://krakenjs.com/我正在尝试使用http://krakenjs.com/ 上提供的指南安装 krakenjs
when i am trying to run yo kraken this command i get this error当我尝试运行yo kraken这个命令时,我收到了这个错误

fs.js:39
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:39:5
    at req_ (C:\Users\KIIT\AppData\Roaming\npm\node_modules\generator-kraken\node_modules\natives\index.js:143:24)
    at Object.req [as require] (C:\Users\KIIT\AppData\Roaming\npm\node_modules\generator-kraken\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (C:\Users\KIIT\AppData\Roaming\npm\node_modules\generator-kraken\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)

using following versions使用以下版本
node: 13.12.0节点:13.12.0
gulp gulp
CLI version: 2.2.0命令行版本:2.2.0
Local version: 4.0.2本地版本:4.0.2

The generator-kraken module seems to be using natives as a dependency. generator-kraken模块似乎使用natives作为依赖项。 The natives module has been deprecated , and doesn't behave consistently across all versions of node. natives模块已被弃用,并且在所有节点版本中的行为不一致。

You could use Node v10 to run generator ( yo kraken command).您可以使用 Node v10 运行生成器( yo kraken命令)。 Yomen generator ( yo ) only spits out static code. Yomen 生成器 ( yo ) 只吐出 static 代码。 Once your code has been generated you can return back to node 13, if required.生成代码后,如果需要,您可以返回节点 13。 Since kraken itself doesn't have any dependency on natives, you shouldn't face any problem running the generated code with node 13. You can use nvm to quickly switch between versions of node, if you aren't already.由于 kraken 本身对本机没有任何依赖关系,因此使用 node 13 运行生成的代码应该不会遇到任何问题。如果您还没有使用nvm在 node 版本之间快速切换,您可以使用它。

Another viable option would be to skip the 'generator' altogether and start with one the examples repos mentioned on Kraken home page here .另一个可行的选择是完全跳过“生成器”并从Kraken 主页上提到的示例 repos 开始。 You could clone one of those repositories and adapt it to your use.您可以克隆其中一个存储库并使其适应您的使用。 Or, use them as reference and create your own setup from scratch.或者,将它们用作参考并从头开始创建您自己的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM