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

Error! primordials is not defined #357

Open
EvgeniiaVak opened this issue Nov 8, 2019 · 11 comments
Open

Error! primordials is not defined #357

EvgeniiaVak opened this issue Nov 8, 2019 · 11 comments

Comments

@EvgeniiaVak
Copy link

Description

When trying to get data I receive an error:

evgeniyavakarina datahub-io-test $ data get https://datahub.io/examples/simple-graph-spec
(node:82843) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
> Error! primordials is not defined

Publishing data works fine.

My environment

MacOS Catalina
node 12.12.0
npm 12.12.0
data 0.9.6

@subhamaharjan
Copy link

subhamaharjan commented Nov 19, 2019

Description

When trying to use data get command

subha@Lenovo-ideapad-320-15IKB:~/Desktop/Work/dp$ data get https://datahub.io/examples/sample/r/sample.csv
(node:13749) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
> Error! primordials is not defined

My environment

Linux Mint-Cinnamon 4.2.4
node 13.1.0
npm 6.13.1
data 0.9.6

Works completely fine in windows, but getting error in linux

@joao-parana
Copy link

+1

@sglavoie
Copy link
Contributor

sglavoie commented Apr 19, 2020

Initially, I was getting the message Error! primordials is not defined when executing the following command:

data get https://datahub.io/examples/sample/r/sample.csv

Some Googling quickly led me to test out other Node.js versions and indeed that solved the issue right away. In the npm package page for data-cli, we find the following information:

You need to have Node.js version >7.6

  • However, I recently updated Node.js to v13.13.0 and it caused the above error message to appear.
  • Moreover, I downgraded one major version to v12.16.2 and the same error would manifest.
  • Finally, I downgraded once again to v11.15.0 and it fixed the issue without having to do anything else (I can confirm it also worked on node v10.x.x).

My environment

Linux debian 4.19.0-8-amd64
node 11.15.0
npm 6.14.4
data 0.9.6

Therefore, I believe the documentation should probably be updated to point out this shortcoming as the error message didn't help much in solving the problem.

@rufuspollock
Copy link
Member

@sglavoie can we look for an actual patch for this - it looks like it will be some library not working under node >= 12. Can you see (quickly) if you can identify the source and we then pin the library or similar (e.g. it looks like graceful-fs may be the source).

@sglavoie
Copy link
Contributor

@rufuspollock, I didn't have much luck trying to debug this so far. I could of course keep trying, but then it won't be "quickly" anymore.

I tried under Node 13.x and 12.x:

  • Updating packages with npm-check-updates, including all outdated packages.
  • Downgrading graceful-fs to earlier versions.
  • Figuring out where issues are with node --trace-deprecation.
  • Adding debug print statements in the relevant files.

Although not a great fix, I have seen this error message pop up with other packages such as Gulp and unzip. Suggestions were in those instances to update the packages or downgrade Node to a version <12. This is clearly not a proper fix, but knowing how to temporarily work around the issue for now can still prove useful until this is debugged further. 🤷‍♂️

@sglavoie
Copy link
Contributor

sglavoie commented May 27, 2020

@rufuspollock, you were right once again! 😄 graceful-fs was the culprit.

Summary

Updating graceful-fs to version 4.2.3 solved the issue with Node.js >11.15 (the last Node version working with a monkey patch in older versions of graceful-fs).

Using

  • node v13.14.0
  • npm 6.14.4
  • yarn 1.22.4

Result with default data-cli 0.9.6

$ data get https://datahub.io/examples/simple-graph-spec

(node:32073) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
> Error! primordials is not defined

Result with patched data-cli 0.9.6

Addition to package.json

The section resolutions was added between scripts and xo like so:

  "scripts": {
    ...
  },
  "resolutions": {
    "graceful-fs": "4.2.3"
  },
  "xo": {
    ...
  },

Output with patched version

Starting with a cleanly cloned repo with the modified package.json as explained above:

$ yarn install

yarn install v1.22.4
[1/4] Resolving packages...
warning Resolution field "[email protected]" is incompatible with requested version "graceful-fs@~3.0.2"
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 3.12s.

$ cd bin/
$ ./data.js get https://datahub.io/examples/simple-graph-spec

Time elapsed: 2.41 s
Dataset/file is saved in "examples/simple-graph-spec"

# show that `data get` was successful
# by creating the directory `examples`
$ tree examples/

examples
└── simple-graph-spec
    ├── data
    │   ├── 96611310bf6bd890f9f10a342a04f8ab
    │   │   └── validation_report.json
    │   ├── vix-daily.csv
    │   ├── vix-daily_csv.csv
    │   ├── vix-daily_csv_preview.json
    │   └── vix-daily_json.json
    └── datapackage.json

Reached out to @anuveyatsu to let him know. I can work on a pull request once a proper fix is confirmed.

@sglavoie
Copy link
Contributor

@EvgeniiaVak, the above change was merged in the project. It has not been published yet as a new release on npmjs.com, but you could install it by cloning the repo:

git clone [email protected]:datopian/data-cli.git
cd data-cli
yarn install
./bin/data.js get https://datahub.io/examples/simple-graph-spec

Let me know if that works for you! 🙂

@rufuspollock
Copy link
Member

rufuspollock commented Jun 19, 2020

@sglavoie can you get permissions from @anuveyatsu to publish to npm so that you can get this fix published officially. 🚀

@sglavoie
Copy link
Contributor

@rufuspollock, yes, I'll ping him right now!

sglavoie pushed a commit that referenced this issue Jun 19, 2020
* This is to fix `Error! primordials is not defined` when using
  Node.js >=12.x.
* Stop testing against older versions of Node.js as there were breaking
  changes with recent versions of `graceful-fs`.
@EvgeniiaVak
Copy link
Author

EvgeniiaVak commented Jun 20, 2020

@sglavoie Yes, ./bin/data.js get https://datahub.io/examples/simple-graph-spec did work for me. Thank you.

@rendall
Copy link

rendall commented Oct 2, 2020

I can confirm that putting

"resolutions": {
    "graceful-fs": "4.2.3"
  },

in package.json resolved the error primordials is not defined

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