node-fetch@^3 is not compatible w/ this cli
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
# Description
As I was attempting to publish the latest version i was getting
```bash
❯ npm publish
> wrhs@1.1.1 prepack
> oclif-dev manifest && oclif-dev readme
Error Plugin: wrhs: require() of ES Module /Users/rmarkins/dev/opensource/wrhs/node_modules/node-fetch/src/index.js from /Users/rmarkins/dev/opensource/wrhs/src/utils/request.js not supported.
Instead change the require of index.js in /Users/rmarkins/dev/opensource/wrhs/src/utils/request.js to a dynamic import() which is available in all CommonJS modules.
Code: ERR_REQUIRE_ESM
npm ERR! code 1
npm ERR! path /Users/rmarkins/dev/opensource/wrhs
npm ERR! command failed
npm ERR! command sh -c oclif-dev manifest && oclif-dev readme
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rmarkins/.npm/_logs/2022-05-05T23_09_26_028Z-debug-0.log
```
this was due to `node-fetch` no longer supporting commonjs require and being esm only. We should look to move away from this package if we continue to be commonjs only.
Contributor guide
Research direction
Start with src/utils/request.js and the npm publish prepack command shown in the report. Reproduce the failure with npm publish, then investigate the CommonJS and ES module compatibility of the request dependency. Done means the prepack step completes without the ERR_REQUIRE_ESM error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100