You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
node --version
v16.14.0
npm --version
8.3.1
Dependabot updated node-fetch from 2.x to 3.x. This causes the following error when running yarn run start-ui
[2022-02-16T10:02:02.057] [INFO] appid-WebAppStrategy-config - redirectUri http://localhost:3000/ibm/cloud/appid/callback
/Pyrrha-Dashboard/pyrrha-dashboard/api-auth/services/appId.js:1
const fetch = require('node-fetch');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Pyrrha-Dashboard/pyrrha-dashboard/api-auth/node_modules/node-fetch/src/index.js from /Pyrrha-Dashboard/pyrrha-dashboard/api-auth/services/appId.js not supported.
Instead change the require of index.js in /Pyrrha-Dashboard/pyrrha-dashboard/api-auth/services/appId.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Pyrrha-Dashboard/pyrrha-dashboard/api-auth/services/appId.js:1:15)
at Object.<anonymous> (/Pyrrha-Dashboard/pyrrha-dashboard/api-auth/rest/routes.js:5:25)
at Object.<anonymous> (/Pyrrha-Dashboard/pyrrha-dashboard/api-auth/server.js:11:16) {
code: 'ERR_REQUIRE_ESM'
node-fetch from v3 is an ESM-only module - you are not able to import it with require().
If you cannot switch to ESM, please use v2 which remains compatible with CommonJS. Critical bug fixes will continue to be published for v2.
Alternatively, you can use the async import() function from CommonJS to load node-fetch asynchronously
Yes. That was the quick fix. Need to check if there are any security issues with the lower version. What got fixed in the next version and if we need to move up.
Is your feature request related to a problem? Please describe.
Dependabot updated node-fetch from 2.x to 3.x. This causes the following error when running
yarn run start-ui
Describe the solution you'd like
The error is documented here - https://github.com/node-fetch/node-fetch#commonjs
We can also look at other libraries like axios.
Describe alternatives you've considered
N/A
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: