bcgov / PIMS

Property Inventory Management System
https://pims.gov.bc.ca
Apache License 2.0
47 stars 43 forks source link

Update github-api-requests.js octokit import method #2491

Closed TaylorFries closed 3 months ago

TaylorFries commented 3 months ago
## 🎯 Summary

Hopefully this will fix the error in the npm report action: link to error

Run node .github/helpers/create-npm-dep-report-issues

/__w/PIMS/PIMS/.github/helpers/github-api/github-api-requests.js:44
const { Octokit } = require("@octokit/rest");
                    ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /__w/PIMS/PIMS/node_modules/@octokit/rest/dist-src/index.js from /__w/PIMS/PIMS/.github/helpers/github-api/github-api-requests.js not supported.
Instead change the require of index.js in /__w/PIMS/PIMS/.github/helpers/github-api/github-api-requests.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/__w/PIMS/PIMS/.github/helpers/github-api/github-api-requests.js:44:21) {
  code: 'ERR_REQUIRE_ESM'
}
Node.js v21.5.0

🔰 Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.