capacitor:add @capacitor-community/electron fails on BigSur
See original GitHub issueProblem
Today I tried to install the @capacitor-community/electron package. The installation works fine at first, but when I try to “npx cap add @capacitor-community/electron” I get the following error:
> @capacitor-community/electron@1.3.2 capacitor:add
> node dist/cap-scripts.js add
✖ Adding Electron platform: The "path" argument must be of type string. Received undefined
node:internal/process/promises:225
triggerUncaughtException(err, true /* fromPromise */);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:278:15)
at validateString (node:internal/validators:123:11)
at Object.join (node:path:1039:7)
at Object.i [as getCwd] (/Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:2:521)
at a (/Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:6:197)
at Object.n [as doAdd] (/Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:6:960)
at /Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:12:363
at Object.g [as runTask] (/Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:2:1902)
at i (/Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:12:311)
at /Users/user/project/node_modules/@capacitor-community/electron/dist/cap-scripts.js:12:718 {
code: 'ERR_INVALID_ARG_TYPE'
}
npm ERR! code 1
npm ERR! path /Users/user/project/node_modules/@capacitor-community/electron
npm ERR! command failed
npm ERR! command sh -c node dist/cap-scripts.js add
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2020-12-11T06_57_03_068Z-debug.log
Environment
- MacOS BigSur 11.0.1
- @capacitor/cli version: 2.4.4
- @capacitor/core version 2.4.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Capacitor Community Electron Platform - IONIC - Angular - ...
When I'm using the capacitator electron plaftorm it works fine, but it says that it is Depracated and should use Capacitator Community Electron....
Read more >Electrolytic capacitor
The failure of electrolytic capacitors can be hazardous, resulting in an explosion or fire. Bipolar electrolytic capacitors which may be operated with either ......
Read more >Apple Silicon Support
One thing of note is that the Xcode upgrade will introduce a new version of the macOS SDK, which may cause build failures...
Read more >err! could not determine executable to run
I was trying to run the command "npx sequelize db:create" in my VSCode and ran into the error "npm ERR! could not determine...
Read more >Capacitor by Ionic - Cross-platform apps with web technology
Build iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Aye, updating npm to 7.3 resolved the above issue. Now it claims, it couldn’t find capacitor.config.json - which is exactly where it should be 😃 Edit: In other words, from my side: this might necessitate a hint in the docs, but for me this issue can be closed.
I experienced this too. For me, it was because I was running an old version of node/npm that did not yet support the
INIT_CWD
env var (introduced in v5.4.0). This was causing this line to fail because it’s passed undefined, which ts doesn’t catch because it’s asserted as non-null.@michi7801 didn’t post their npm version so I can’t be 100% sure, but I’d bet this is the problem @ri0t is experiencing as well because the variable was accidentally removed in npm v7 and only re-added in v7.1.2.
Updating my npm locally allowed
cap add
to run successfully.