-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxError: The requested module 'node:fs/promises' does not provide an export named 'constants' #736
Comments
I tested a little tiny bit and importing "fs" gave me the constants, but "node:fs/promises" did not. |
Switching to the version stated |
I ended up switching between versions until one of them worked, I think it was Node v19, but I mix numbers up really easy. |
I realise what the problem is now:
|
Each library maintainer can pick and choose what their library does and doesn't support. You can use a Node Version Manager to switch to different versions. You'll find the least trouble with NW.js (and really all technology related to JavaScript) by sticking with the latest versions of everything. But specifically making sure your global Node.js version matches the version built in to NW.js. Node Version Managers:
The last NW.js version with Node 14 support was 0.49.1 (from October 2020). You would be best off switching to the latest version of NW.js (0.76.1) and installing the same version of Node.js globally (20.1.0). There are some legitimate reasons to use older versions of NW.js. And maybe you have one. Others might too. Ideally If there is a way to transpile newer Node to older versions we could try that, but the only option I know of is Babel, and it doesn't work for the supplied code. The
RecommendationsOption 1: Stick to the latest
Option 2: Use older automated build tools You can try an older version of Option 3: Write your own custom build script Depending on your project's needs you may be able write a build script that Or you may need to abandon use of In all of these scenarios we are assuming your global Node version matches your NW.js's Node version. As this should always be the case. |
Issue Type
Current/Missing Behaviour
This error is displayed, I'd use the cli version, but my NPM doesn't make commands globally usable.
Expected/Proposed Behaviour
it to work
Additional Info
I don't usually work with ESM, I tried using Common JS, but it was just erroring with 1 so I couldn't figure out what was wrong.
I tried to make an ESM script, but this was the error, and using import() from Common JS yielded the same error.
The text was updated successfully, but these errors were encountered: