I am new to node js and have started looking into migrating a nodejs application from node v8 to node v12. In doing so, I am facing the following error:
ReferenceError: primordials is not defined
at fs.js:36:5
at req_ (/usr/local/lib/node_modules/tsd/node_modules/natives/index.js:143:24)
at Object.req [as require]
(/usr/local/lib/node_modules/tsd/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/usr/local/lib/node_modules/tsd/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
From my understanding of what I have read on the internet, the problem is because of graceful-fs conflict with node v12, where they patched the fs library.
We are using grunt-tsd 0.1.0 (the latest released version) in our project.
When I check the node dependency tree, I see that graceful-fs version under this grunt-tsd dependency is 2.0.3. I am suspecting this is the cause of the above error (since old version of graceful-fs are not compatible with node v12). The exact dependency of grunt-tsd on graceful-fs looks like this:
grunt-tsd@0.1.0 -> tsd@0.5.7 -> update-notifier@0.1.7 -> configstore@0.1.7 -> graceful-fs@2.0.3
Is there a way we can make the grunt-tsd 0.1.0 use the latest graceful-fs version? Appreciate any help with resolving this.
Note: I have read that there are issues with gulp 3 and node v12, but we are not using gulp in our project. Also, downgrading the node version to 10 or 11 is not an option for me.