antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

don't working in node 14 #197

Open Debbl opened 8 months ago

Debbl commented 8 months ago

Describe the bug

I get an error, because the node 14 doesn't have built-in node:timers/promises

related issues https://github.com/antfu/ni/issues/192

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:timers/promises
    at new NodeError (internal/errors.js:322:7)
    at Loader.builtinStrategy (internal/modules/esm/translators.js:285:11)
    at new ModuleJob (internal/modules/esm/module_job.js:63:26)
    at Loader.getModuleJob (internal/modules/esm/loader.js:258:11)
    at async ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:78:21)
    at async Promise.all (index 11)
    at async link (internal/modules/esm/module_job.js:83:9) {
  code: 'ERR_UNKNOWN_BUILTIN_MODULE'
}

Reproduction

sudo npm i n -g
sudo n 14
ni

the error

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:timers/promises
    at new NodeError (internal/errors.js:322:7)
    at Loader.builtinStrategy (internal/modules/esm/translators.js:285:11)
    at new ModuleJob (internal/modules/esm/module_job.js:63:26)
    at Loader.getModuleJob (internal/modules/esm/loader.js:258:11)
    at async ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:78:21)
    at async Promise.all (index 11)
    at async link (internal/modules/esm/module_job.js:83:9) {
  code: 'ERR_UNKNOWN_BUILTIN_MODULE'
}

It seems to be an extra problem, it works if I change execa to 7.1.1.

- "execa": "^8.0.1",
+ "execa": "^7.1.1",

Reproduction

above

System Info

System:
    OS: macOS 14.2
    CPU: (8) x64 Apple M1 Pro
    Memory: 43.56 MB / 16.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 14.20.0 - /usr/local/bin/node
    npm: 6.14.17 - /usr/local/bin/npm
    bun: 1.0.14 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 120.0.6099.109
    Safari: 17.2

Used Package Manager

npm

Validations

Cheng-DX commented 5 months ago

In some new version of ni has dropped node v14 support, you can use some old versions like 0.21.3, which is fine with v14

antfu commented 5 months ago

I don't mind downgrading execa, but for future-proof I'd also suggest you to upgrade your node.

PR Welcome :)