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 js require / import #2

Open
ayssel-uct opened this issue Feb 16, 2022 · 1 comment
Open

Node js require / import #2

ayssel-uct opened this issue Feb 16, 2022 · 1 comment

Comments

@ayssel-uct
Copy link

ayssel-uct commented Feb 16, 2022

Hi Sergei. Which versions of nodejs and nvm/npm shoud I use?
Using only a single sample as input , I can get the ogv-dating pipeline to run to near completion (80%). The errors that I get relates to some node modules (things that I had to install such as commander, pretty-data etc). Once I installed all of those I get the error pasted below :
I am out of my depth here.According to Google and Stackoverflow this has something to do with nvm. I installed different versions of nvm. If I use 12.0.0. and 13.0.0 I could install commander (my nvm install command did not work when using the LTS version) Should I change something in the compute-distance js script? Should I use a different version of nodejs? Thanks in advance.
/home/ayssel/ogv-dating/scripts/compute-distance.js:7 const csvParse = require("d3").csvParse; ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /home/ayssel/node_modules/d3/src/index.js from /home/ayssel/ogv-dating/scripts/compute-distance.js not supported. Instead change the require of index.js in /home/ayssel/ogv-dating/scripts/compute-distance.js to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (/home/ayssel/ogv-dating/scripts/compute-distance.js:7:18) { code: 'ERR_REQUIRE_ESM' }

@ayssel-uct
Copy link
Author

Nevermind. Fixed it. They solution was to downgrade all my npm packages to versions from a few years ago. Incase anyone wonders, these are the versions I have now.
├── @babel/core@7.17.3
├── @babel/node@7.16.8
├── 5@0.0.1
├── commander@2.20.3
├── common@0.2.5
├── commonjs@0.0.1
├── csv-parse@3.1.3
├── csv@3.1.0
├── d3@5.6.0
├── fast-csv@1.2.0
├── fs@0.0.2
├── next-transpile-modules@9.0.0
├── node-fetch@2.6.7
├── pfs@3.0.0
├── phylotree@1.0.0-alpha.17
├── pretty-data@0.40.0
├── rollup-plugin-node-resolve@5.2.0
└── underscore@1.13.2

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

1 participant