`node-fetch` is no longer required
RobinTail opened this issue Β· comments
As of Node 18, fetch
is within the globals:
https://dev.to/cloudx/nodejs-18-fetch-api-test-runner-module-and-more-2ckg
@types/node-fetch
or lib: ["dom"]
in tsconfig.json
, however, might be required due to this issue (it's still experimental):
DefinitelyTyped/DefinitelyTyped#60924
Nevertheless, your amazing package requires Node 18 via one of its dependencies anyway:
marked@5.1.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.20.0"
=> Found "marked@5.1.0"
info Reasons this module exists
- "@arethetypeswrong#cli" depends on it
- Hoisted from "@arethetypeswrong#cli#marked"
, so I'd suggest to set
"engines": {
"node": ">=18"
},
in package.json
and remove node-fetch
and fetch-ponyfill
from the dependencies.
Does it actually fail in Node 16 due to marked
, or is this just a warning? My intention is to support Node 16 until the end of its maintenance window, which is in... two weeks π
Hello @andrewbranch ,
Your package can not be installed in environment having Node 16 (at least without because of --ignore-engines
flag of yarn
)marked
's constraints.
Here is was the output of my CI workflow when I tried:
### Run yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
error marked@5.1.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.20.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Process completed with exit code 1.
Currently I'm going to drop Node 16 in my library, so I'm beginning using your package in my CI.
Correction, @andrewbranch , sorry:
I found out that later marked
fixed this. It was >=18
in v5.1.0, but already in v5.1.2 they fixed it to >= 16
.
Therefore, @andrewbranch , in order to support Node 16, I'd suggest to adjust the version of marked
in your package.json
:
- "marked": "^5.1.0"
+ "marked": "^5.1.2"
Perhaps I had this issue when marked
5.1.2 was not yet released, so it resolved to 5.1.0 when I tried to install your package.
I can confirm that at the moment there is no issue installing your package on Node 16:
$ yarn add @arethetypeswrong/cli
yarn add v1.22.11
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π¨ Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
info Direct dependencies
ββ @arethetypeswrong/cli@0.8.0
info All dependencies
ββ @andrewbranch/untar.js@1.0.2
ββ @arethetypeswrong/cli@0.8.0
ββ @arethetypeswrong/core@0.8.0
ββ @colors/colors@1.5.0
ββ ansicolors@0.3.2
ββ builtins@5.0.1
ββ cardinal@2.1.1
ββ commander@10.0.1
ββ fetch-ponyfill@7.1.0
ββ fflate@0.7.4
ββ marked-terminal@5.2.0
ββ marked@5.1.2
ββ node-emoji@1.11.0
ββ node-fetch@2.7.0
ββ redeyed@2.1.1
ββ tr46@0.0.3
ββ validate-npm-package-name@5.0.0
$ nvm current
v16.13.2
π