sindresorhus / awesome-lint

Linter for Awesome lists
MIT License
600 stars 56 forks source link

Running awesome-lint is failing with ERR_REQUIRE_ESM for `unist-util-find` #166

Closed Unkn0wnCat closed 1 year ago

Unkn0wnCat commented 1 year ago

Hey,

I'm running the linter on the GitHub repo osmlab/awesome-openstreetmap and it is failing with the error ERR_REQUIRE_ESM on the dependency unist-util-find

Error message: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/unist-util-find/index.js from /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js not supported.

For a full log see: https://github.com/osmlab/awesome-openstreetmap/actions/runs/5243798057/jobs/9561060602?pr=140

Thanks in advance, Kevin

ulises-jeremias commented 1 year ago

same here https://github.com/nanlabs/awesome-nan/actions/runs/5285574254/jobs/9564746289

kdeldycke commented 1 year ago

Yep, can confirm the issue!

npm WARN exec The following package was not found and will be installed: awesome-lint@0.18.2
/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js:2
const find = require('unist-util-find');
             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/unist-util-find/index.js from /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js not supported.
Instead change the require of index.js in /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js:2:14)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/index.js:9:2)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/config.js:61:5)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/index.js:14:16)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/cli.js:5:21) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v18.16.0

Source: https://github.com/kdeldycke/awesome-billing/actions/runs/5287262077/jobs/9567541852#step:3:6

UlisesGascon commented 1 year ago

Confirmed here too:

Run npx awesome-lint

npm WARN exec The following package was not found and will be installed: awesome-lint@0.18.2
/home/runner/.npm/_npx/b[4](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:4)a07bb0d903[4](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:5)d[5](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:6)3/node_modules/awesome-lint/rules/license.js:2
const find = require('unist-util-find');
             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/unist-util-find/index.js from /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js not supported.
Instead change the require of index.js in /home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/license.js:2:14)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/rules/index.js:9:2)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/config.js:[6](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:7)1:5)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a0[7](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:8)bb0d9034d53/node_modules/awesome-lint/index.js:14:16)
    at Object.<anonymous> (/home/runner/.npm/_npx/b4a07bb0d9034d53/node_modules/awesome-lint/cli.js:5:21) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v1[8](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:9).[16](https://github.com/onebeyond/awesome-proof-of-concept/actions/runs/5309323867/jobs/9609831946?pr=12#step:3:17).0
Error: Process completed with exit code 1.

It is working fine in my local machine 🤔

Captura de pantalla 2023-06-19 a las 10 06 43

sindresorhus commented 1 year ago

The problem is caused by https://github.com/blahah/unist-util-find/issues/12

Unkn0wnCat commented 1 year ago

Works great again, thanks for the quick fix @sindresorhus! 🎉