You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[O] For issue in production release, add devtools output of DEBUG_PROD=true npm run build && npm start
Expected Behavior
When running npm install right after git clone, the install should not fail.
Current Behavior
npm install fails when it reaches the postinstall script.
Steps to Reproduce
There are two problems I have encountered:
First, when I run npm install, it installs dependencies and runs the postinstall script, at which point the script fails, complaining about the lack of "type": "module" declaration:
> charl-e@0.0.2 postinstall
> ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts
(node:37969) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/XXX/Projects/charl-e/.erb/scripts/check-native-dep.js:1
import fs from 'fs';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1048:15)
at Module._compile (node:internal/modules/cjs/loader:1083:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Object.require.extensions.<computed> [as .js] (/Users/XXX/Projects/charl-e/node_modules/ts-node/src/index.ts:1608:43)
I don't know how this is working on your machine but I assume you have to put "type": "module" in package.json so I added it and tried running npm install again.
But now I have a second issue:
> ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///Users/XXX/Projects/charl-e/package.json" needs an import assertion of type "json"
In this case I thought this was because you're using some edge node.js version that supports features not supported by stable version, so I even tried updating my node.js version to the latest 18.9.0 and ran the command again, but it still fails with the same error.
My questions are:
How are you able to use the import syntax without specifying the "type": "module" inside package.json? And do we need to add that line in the package.json file?
Even after adding the module declaration I can't get it to work, how can I just run npm install without failing?
Are there any other things I need to keep in mind when building locally?
Context
How has this issue affected you?: I wanted to build the project locally and potentially contribute
Did you make any changes? No
Your Environment
Node version : tried both 16.17.0 and 18.9.0
electron-react-boilerplate version or branch: I just cloned the exact same code here and ran
Operating System and version : Mac OS Monterey 12.5.1
The text was updated successfully, but these errors were encountered:
Prerequisites
main
branchDEBUG_PROD=true npm run build && npm start
Expected Behavior
When running
npm install
right after git clone, the install should not fail.Current Behavior
npm install
fails when it reaches thepostinstall
script.Steps to Reproduce
There are two problems I have encountered:
First, when I run
npm install
, it installs dependencies and runs thepostinstall
script, at which point the script fails, complaining about the lack of"type": "module"
declaration:I don't know how this is working on your machine but I assume you have to put "type": "module" in package.json so I added it and tried running
npm install
again.But now I have a second issue:
In this case I thought this was because you're using some edge node.js version that supports features not supported by stable version, so I even tried updating my node.js version to the latest
18.9.0
and ran the command again, but it still fails with the same error.My questions are:
import
syntax without specifying the"type": "module"
insidepackage.json
? And do we need to add that line in the package.json file?npm install
without failing?Context
Your Environment
The text was updated successfully, but these errors were encountered: