Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 12: Errors with 'primordials is not defined' #5

Closed
josephg opened this issue May 9, 2019 · 9 comments
Closed

Node 12: Errors with 'primordials is not defined' #5

josephg opened this issue May 9, 2019 · 9 comments

Comments

@josephg
Copy link

josephg commented May 9, 2019

prebuildify-ci is working fine with node 11:

$ nvm use 11
Now using node v11.14.0 (npm v6.7.0)
$ npx prebuildify-ci download
Downloading prebuilds from josephg/node-foundationdb@0.10.1
Downloading v0.10.1-win-x64.zip
Downloading v0.10.1-osx-x86_64.tar
Downloading v0.10.1-linux-x86_64.tar
All available prebuilds downloaded and stored in ./prebuilds

But failing with node 12:

$ nvm use 12
Now using node v12.1.0 (npm v6.9.0)
$ npx prebuildify-ci download
primordials is not defined

I get a stack trace when run through npm scripts:

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/Users/josephg/src/node-fdb/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/josephg/src/node-fdb/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/josephg/src/node-fdb/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)
@josephg
Copy link
Author

josephg commented May 9, 2019

It looks like an error with natives, which is fixed when using graceful-fs@4

$ npm ls --dev natives
foundationdb@0.10.1 /Users/josephg/src/node-fdb
└─┬ prebuildify-ci@1.0.4
  └─┬ unzip@0.1.11
    └─┬ fstream@0.1.31
      └─┬ graceful-fs@3.0.11
        └── natives@1.1.6 

@josephg
Copy link
Author

josephg commented May 9, 2019

The problem is that unzip hasn't updated to a more recent version of fstream, which causes this problem. Issue on unzip.

Apparently people recommend against using unzip, and say unzipper is an API-compatible drop-in replacement, which fixes this issue and some other issues.

@ralphtheninja
Copy link
Contributor

@josephg There's already a PR for that #4

@ralphtheninja
Copy link
Contributor

@josephg This is fixed now.

@josephg
Copy link
Author

josephg commented Oct 4, 2019

Thanks! Much appreciated

@manimoto
Copy link

manimoto commented Nov 7, 2019

this error comes when we use older version of graceful-fs. so update to graceful-fs@4.2.3.
so if you will get this primordials error and graceful-fs in stack trace in any of the package just goto that package and npm install graceful-fs@4.2.3. it will solve the problem if it shows this line.
/node_modules/graceful-fs/fs.js:1:37

so like in s3 package i am getting this error. so i just updated s3 package graceful-fs to 4.2.3 and it will works viola :).

@bekagaw653
Copy link

https://blog.icetutor.com/how-to-fix-referenceerror-primordials-is-not-defined-error/

@Pysis868
Copy link

Had this error without gulp(!!) installing over old v10 installtion on Windows using the msi package. Removing that directory's contents and repairing made it work. Why it does not take care in the first place..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants