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.

Error: Cannot find module 'node:fs/promises'

See original GitHub issue

Hi, I’m getting the error:

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'node:fs/promises'
Require stack:
- /Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/file/index.js
- /Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/config/index.js
- /Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/cli.js
- /Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/bin/next-sitemap
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/file/index.js:17:36)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/file/index.js',
    '/Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/config/index.js',
    '/Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/dist/cjs/cli.js',
    '/Users/jonquayle/Sites/next-js-starter/node_modules/next-sitemap/bin/next-sitemap'
  ]
}

when running the post build script. As far as I know ‘node:fs/promises’ is built into node? Having followed the Read me and various tutorials using next-sitemap, I’m at a loss to know what isn’t quite working. Can anyone shed some light for me please?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
iamvishnusankarcommented, Feb 2, 2022

@sandrooco Make sure your node version is >=14.18.3

0reactions
BrunoElocommented, May 19, 2022

@sandrooco Make sure your node version is >=14.18.3

thanks. Could you or someone please add this version requirement to the Readme doc? I just encountered this today and arrived here looking for answers, after scanning the readme for hints.

This still hasn’t been done. Struggled a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'fs/promises' Electron JS - Stack Overflow
Download the latest stable Node version. This should have the 'fs/promises' module and will fix the issue. · Delete the node_modules folder and ......
Read more >
How to solve Cannot find module 'fs/promises'? - Medium
Recently, I need to install npm package name of rotating-file-stream. So, install it and start npm run… npm show error like below: Cannot...
Read more >
Node JS Error: Cannot find module 'fs/promises' - Solved
I will explain this example solve error for cannot find module 'fs/promises' in node js. So, let's start following example with output: Solve ......
Read more >
Cannot find module 'fs/promises' Error in TypeScript | bobbyhadz
To solve the "Cannot find module fs/promises or its corresponding type declarations" error, install the types for node by running the command npm...
Read more >
cannot find module "fs/promises" with nodejs 12.22.7 · Issue #76
It seems Node.js authors was a bit too much furious in changing the fs/promises interface. I've asked on Stack Overflow too...
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