question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: node protocol unsupported

See original GitHub issue

When importing the latest tempy, it fails as it uses the new node: protocol:

Error: Cannot find module 'node:fs'
Require stack:
- /node_modules/.pnpm/tempy@2.0.0/node_modules/tempy/index.js
- /src/cli.ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/node_modules/.pnpm/tempy@2.0.0/node_modules/tempy/index.js:1:42)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at extensions..js (/node_modules/.pnpm/esbuild-register@3.0.0_esbuild@0.13.12/node_modules/esbuild-register/dist/node.js:2703:15)
    at Object.newLoader [as .js] (/node_modules/.pnpm/esbuild-register@3.0.0_esbuild@0.13.12/node_modules/esbuild-register/dist/node.js:2262:9)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/node_modules/.pnpm/tempy@2.0.0/node_modules/tempy/index.js',
    '/src/cli.ts'
  ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
egoistcommented, Nov 9, 2021

🎉 This issue has been resolved in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

0reactions
privatenumbercommented, Nov 9, 2021
It's back-ported:

Screen Shot 2021-11-09 at 3 22 52 AM

Using the same version of Node.js, setting "type": "module" in package.json, then running node index.js will work fine to resolve the node: protocol.

I guess this doesn’t work because esbuild converts imports to requires, which requires 14.18.0.

However, given esbuild-register back-ports ESM support to older versions of Node.js, I would expect it to be able to back-port node: as well. Surely this is easy as removing node: from the specifier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection closed due to error Error: Unsupported protocol ...
You have made a mistake in your pasting API key. Check your API key it will not be like URL. http:// is missing...
Read more >
Hardhat errors | Ethereum development environment for ...
A Solidity file is trying to import a file using an unsupported protocol, like http. You can only import files that are available...
Read more >
Common errors | npm Docs
It's most likely a temporary npm registry glitch. Check npm server status and try again later. · If the error persists, perhaps the...
Read more >
Node js Error: Protocol "https:" not supported. Expected "http:"
JavaScript : Node js Error : Protocol "https:" not supported. Expected "http:" [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >
Unsupported protocol "undefined" || Solved - YouTube
This video show how to solve connection closed due to errors in Nodejs.Subscribe this channel to get solution for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found