Christmas-Community
Christmas-Community copied to clipboard
Bug: version 1.35.0
Please add "node-fetch": "^2.7.0",
to package.json
as node-fetch 3 would require the use of the import statment `` which is only available in ts
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/user/CAMSERVER/node_modules/node-fetch/src/index.js require() of ES modules is not supported. require() of /home/user/CAMSERVER/node_modules/node-fetch/src/index.js from /home/user/CAMSERVER/server.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/user/CAMSERVER/node_modules/node-fetch/package.json.
If you chose to switch to type script though please do me a big favour and use git mv
to rename files in a seperate commit because otherwise renames are likely not tracked properly.
I did port the project to TS today. Are you trying to execute the source code? Try npm run build
then node built/index.js
.
Sorry the Issue isn't a hundred percent clear, I was trying to run the project at commit "1.35.0" and ran into the issue of missing node-fetch. Running npm install node-fetch yielded the import statment error, thus "node-fetch": "^2.7.0", was required
in the package.json
to fix the issue.