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.

capacitor:add @capacitor-community/electron fails on BigSur

See original GitHub issue

Problem

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ri0tcommented, Jan 2, 2021

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.

1reaction
kanatzidiscommented, Jan 1, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

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