rxaviers / cldr-data-downloader

Download tool for Unicode CLDR JSON data
MIT License
16 stars 24 forks source link

deepEqual throws an error on Node 8, NPM 5 #24

Open thure opened 7 years ago

thure commented 7 years ago

Installing cldr-data using Node 8 & NPM 5 throws this error:

> cldr-data@28.0.5 install <<project dir>>/node_modules/cldr-data
> node install.js

Whops {} deepEqual { url: 
   [ 'https://github.com/unicode-cldr/cldr-core/archive/28.0.2.zip',
     'https://github.com/unicode-cldr/cldr-dates-mo

Where <<project dir>> is the working directory of npm install.

I can't tell why the error is truncated, or if this is just the intended error. Installing with Node v7.5.0 and NPM 4.1.2 works.

liesislukas commented 7 years ago

Just got same error.

node 8.0.0 npm 5.0.4 OS X

works well when downgraded to node 6.10.3

jzaefferer commented 7 years ago

There are some mentions of deepEqual in the node 8.x changelog, but nothing marked as breaking: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V8.md

Might be a regression in node 8, or one of those "bug that turned into a feature".

jzaefferer commented 7 years ago

Googling for "node 8 deepequal" brings up this issue as the first result.

Probably this isn't related to deepEqual at all.

jzaefferer commented 7 years ago

Or is it? Maybe this isn't working anymore: https://github.com/rxaviers/cldr-data-downloader/blob/f60385580b7db9ef8a0a8a137d95e08abccb854e/lib/util.js#L20-L23

jzaefferer commented 7 years ago

Well, the util/deepEqual method seems to work fine, I guess the problem is indeed in the data passed into it.

For debugging, should change this line: https://github.com/rxaviers/cldr-data-downloader/blob/285cde6a39a54ea42d87d4f6d410b87ec54bd23f/bin/download.js#L82 - to output error.stack instead of error.message. stack includes the message, AND the stack trace.

jzaefferer commented 7 years ago

After trying this again myself (got the error report from someone else today), I was unable to reproduce the error.

$ node --version
v8.1.4
$ npm --version
5.0.3

Does someone else have the issue with these versions? Maybe it got indeed fixed.

jzaefferer commented 7 years ago

Though the report I got today was also on node 8.1.4. No idea.

tonovotny commented 7 years ago

Same error here, node v8.1.4 and npm 5.0.3

marvinhagemeister commented 7 years ago

The error occurs because state.json is missing. This file should be created when installing cldr-data but somehow this is not the case. If it isn't there the default is an empty object {} which leads to the deepEqual failure. Will continue to debug further...

mahyard commented 7 years ago

I solved this issue by modifying cldr-data-downloader/lib/util.js this way: https://pastebin.com/3m5Kaqpj I made a delay on running deepEqual by using a setTimeout. I know it's just a trick and not the solution but may help to find it.

rxaviers commented 7 years ago

Given the two last comments, i.e., the missing state.json and the use of a timeout to fix the problem, it looks like in npm 8, the post installation is executed prior to the node_modules files creation. Is it? Can someone confirm? If so, it looks like we need to use a different approach, something like this https://github.com/rxaviers/cldr-data-npm/issues/28

ozum commented 7 years ago

Is there any progress on this?

I have same problem.

Node v8.6.0 npm 5.4.2

rxaviers commented 7 years ago

Anyone willing to provide a fix? Guideline in my above comment.

a7madgamal commented 7 years ago

this is blocking node 8 for me :( 🆘

tinganho commented 7 years ago

I've got this error as well, updating cldr-data@31.0.2 package resolved this issue but produced another one.

Received 41238K total.
Unpacking it into `./`
Whops ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/l10ns/node_modules/cldr-data/.gitattributes'
tinganho commented 7 years ago

It seems like adm-zip is not allowed to write to the folder in cldr-data:

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/l10ns/node_modules/cldr-data-test/.gitattributes
rxaviers commented 6 years ago

Heads up: A workaround for this problem is to use yarn instead of npm.

flipchart commented 6 years ago

So with node 9.2.0, npm install works (npm 5.5.1), but yarn (1.3.2) produces the same deepEqual error

dijonkitchen commented 6 years ago

FYI, I encountered this on version 28 as well, but upgrading to the latest (version 32) of cldr-data worked properly.

node v8.9.4 (npm v5.6.0)

hon2a commented 6 years ago

Heads up: A workaround for this problem is to use yarn instead of npm.

Tried it with yarn, got the same exact error. (node 8.9.0, npm 5.5.1)

Elementenfresser commented 6 years ago

I got the error for version 0.2.x but resolved by upgrading to cldr-data-downloader@0.3.3

(node 8.9.0, npm 5.5.1)