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

"TypeError: Object.fromEntries is not a function" when creating a new locale #644

Closed
lufte opened this issue Apr 7, 2020 · 3 comments · Fixed by #653
Closed

"TypeError: Object.fromEntries is not a function" when creating a new locale #644

lufte opened this issue Apr 7, 2020 · 3 comments · Fixed by #653
Milestone

Comments

@lufte
Copy link
Contributor

lufte commented Apr 7, 2020

I'm following the instructions here to add a new locale, but running npm run generate-langs results in the following error:

lufte@lufte-thinkpad:~/projects/remark42/frontend$ npm run generate-langs

> [email protected] generate-langs /home/lufte/projects/remark42/frontend
> npm run extract-messages && node ./tasks/generateDictionary.js


> [email protected] extract-messages /home/lufte/projects/remark42/frontend
> formatjs extract --out-file=./extracted-messages/messages.json './app/**/*.{js,jsx,ts,tsx}'

/home/lufte/projects/remark42/frontend/tasks/generateDictionary.js:11
  return Object.fromEntries(Object.entries(dictionary).filter(([key]) => existKeys.includes(key)));
                ^

TypeError: Object.fromEntries is not a function
    at removeAbandonedKeys (/home/lufte/projects/remark42/frontend/tasks/generateDictionary.js:11:17)
    at locales.forEach.locale (/home/lufte/projects/remark42/frontend/tasks/generateDictionary.js:33:17)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/lufte/projects/remark42/frontend/tasks/generateDictionary.js:22:9)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate-langs: `npm run extract-messages && node ./tasks/generateDictionary.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] generate-langs script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lufte/.npm/_logs/2020-04-07T01_32_02_023Z-debug.log

I'm running Node 10, and the README stipulates that I need Node 8 or higher, but it seems that Object.fromEntries is not supported until Node 12.11.

@umputun
Copy link
Owner

umputun commented Apr 9, 2020

cc: @Mavrin @akellbl4

@akellbl4
Copy link
Collaborator

akellbl4 commented Apr 9, 2020

Hi @lufte, you should use node 12.11 or higher. We will change readme, thanks for noticing us. Current version of node is correctly mentioned in package.json

@akellbl4
Copy link
Collaborator

akellbl4 commented Apr 9, 2020

It was not exactly 12.11 in package.json. Now I added actual information in PR.

@paskal paskal added this to the v1.6 milestone Jan 15, 2023
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

Successfully merging a pull request may close this issue.

4 participants