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

898 views Asked by At

I am trying to install krakenjs using the guide available on http://krakenjs.com/
when i am trying to run yo kraken this command i get this error

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
gulp
CLI version: 2.2.0
Local version: 4.0.2

1

There are 1 answers

1
d_shiv On BEST ANSWER

The generator-kraken module seems to be using natives as a dependency. The natives module has been deprecated, and doesn't behave consistently across all versions of node.

You could use Node v10 to run generator (yo kraken command). Yomen generator (yo) only spits out static code. Once your code has been generated you can return back to node 13, if required. 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.

Another viable option would be to skip the 'generator' altogether and start with one the examples repos mentioned on Kraken home page here. 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.