Unable to resolve some modules - node:http [solved]

Never had this error before, only recently started appearing on dev server boot up.
The suggested command doesn’t do anything either.
I haven’t noticed anything not working.

=> Started proxy.                             
=> Started HMR server.                        
=> Started MongoDB.                           
                                              
Unable to resolve some modules:

  "node:http" in /home/coder/project/home/dev/node_modules/node-fetch/src/index.js (os.linux.x86_64)
  "node:https" in /home/coder/project/home/dev/node_modules/node-fetch/src/index.js (os.linux.x86_64)
  "node:zlib" in /home/coder/project/home/dev/node_modules/node-fetch/src/index.js (os.linux.x86_64)
  "node:stream" in /home/coder/project/home/dev/node_modules/node-fetch/src/index.js (os.linux.x86_64)
  "node:util" in /home/coder/project/home/dev/node_modules/node-fetch/src/body.js (os.linux.x86_64)
  "node:fs" in /home/coder/project/home/dev/node_modules/fetch-blob/from.js (os.linux.x86_64)
  "node:path" in /home/coder/project/home/dev/node_modules/fetch-blob/from.js (os.linux.x86_64)
  "node:worker_threads" in /home/coder/project/home/dev/node_modules/fetch-blob/from.js (os.linux.x86_64)
  "node:url" in /home/coder/project/home/dev/node_modules/node-fetch/src/request.js (os.linux.x86_64)
                                              
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save node:http node:https node:zlib node:stream node:util node:fs node:path node:worker_threads node:url
                                              
=> Started your app.  

Running:

meteor npm install --save node:http node:https node:zlib node:stream node:util node:fs node:path node:worker_threads node:url

…doesn’t work…

Are you maybe using the node-fetch npm package? I ran into the same issue with this package - version 3.1.0 seems to be incompatible with Meteor’s transpiler. The only solution I have found is to downgrade to 3.0.0 and lock the package version.
There is already a GitHub issue on this topic here: Cannot find module 'node:http` on AWS Lambda v14 · Issue #1367 · node-fetch/node-fetch · GitHub

Yeah I am using node-fetch on the server. It is weird, it works fine, just get those warnings.
Not sure if I should bother worry about it?

The node-fetch is also included in the Meteor fetch package. Fyi

oh I guess that is why it is working… I probably added that meteor package as well. thanks guys!!

Removed node-fetch and added the standard package fetch… it wasn’t installed and the import is different too. So not sure why it was working fine before. Anyway thanks again guys, I would have suffered in silence with that warning :smiley:

1 Like