Closed keganlance closed 2 years ago
In my local is normal.
Please make sure your node version is above 12.
The permission denied
issue has been solved after a reboot. However, I'm still getting the ERR_REQUIRE_ESM
issue. Running node v18.8.0, and pnpm v7.9.3.
After further investigation, it seems a compiled file /dist/cjs/GotDownloader.js
from electron-get
, is trying to require the ESM module got
.
The full warning:
Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/.pnpm/got@12.4.1/node_modules/got/dist/source/index.js from /node_modules/.pnpm/@electron+get@1.14.1/node_modules/@electron/get/dist/cjs/GotDownloader.js not supported.
A subset of /dist/cjs/GotDownloader.js
:
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs-extra");
const got_1 = require("got");
const path = require("path");
const ProgressBar = require("progress");
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
class GotDownloader {
async download(url, targetFilePath, options) {
...
}
}
exports.GotDownloader = GotDownloader;
//# sourceMappingURL=GotDownloader.js.map
The got file /dist/source/index.js
:
import create from './create.js';
import Options from './core/options.js';
const defaults = {
options: new Options(),
handlers: [],
mutableDefaults: false,
};
const got = create(defaults);
export default got;
export { got };
export { default as Options } from './core/options.js';
export * from './core/options.js';
export * from './core/response.js';
export * from './core/index.js';
export * from './core/errors.js';
export { default as calculateRetryDelay } from './core/calculate-retry-delay.js';
export * from './as-promise/types.js';
export * from './types.js';
export { default as create } from './create.js';
export { default as parseLinkHeader } from './core/parse-link-header.js';
Seems another package in combination with pnpm audit added this because of known security issues:
"pnpm": {
"overrides": {
"got@<11.8.5": ">=11.8.5"
}
}
Which might have caused the above issue.
It seems to be caused by other dependencies, is it possible for you to make a separate test case with only the necessary code to reproduce the problem?
Issue has been resolved by removing the "pnpm.overrides" from package.json. It would be solved 100% if electron/get would use the latest GOT version but this might not be doable due to incompatibilities.
When trying to install electron using:
pnpm install electron --save-dev
I get the error:
So I try with sudo::
sudo pnpm install electron --save-dev
Yet get the following error: