Unable to run nodejs project

I am not a programmer in any way but I want to contribute on this repo (GitHub - commenthol/date-holidays: worldwide holidays) and submit a PR, but I am unable to run the test code, as described here.

I googled and googled and finally found a tool called node2nix to setup the environment for the project with the guide.

This is my steps:

$ git clone https://github.com/commenthol/date-holidays
$ cd date-holidays
$ sed -i 's/#semver:1.1.0-0//' package.json # just pull master branch of "@mocha/contributors"
$ node2nix -18 --no-bypass-cache -d
$ git add .
$ nix-shell -A shell

(inside nix-shell)
$ npm run build
$ npm run yaml
$ node test/sample.js "at.w" 2016

And this is the error message:

node:internal/process/esm_loader:40
      internalBinding('errors').triggerUncaughtException(
                                ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'date-holidays-parser' imported from /home/user/github/date-holidays/src/Holidays.js
Did you mean to import date-holidays-parser/lib/index.cjs?
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:916:9)
    at moduleResolve (node:internal/modules/esm/resolve:973:20)
    at defaultResolve (node:internal/modules/esm/resolve:1206:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.20.4

Thanks for your help!

This is the solution:

ln -s $NODE_PATH node_modules
1 Like