capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
335 stars 59 forks source link

The "path" argument must be of type string. Received undefined #143

Closed dgonca closed 3 years ago

dgonca commented 3 years ago

After I do ionic build to build my application I run npx cap copy @capacitor-community/electron and get this error

> @capacitor-community/electron@4.0.3 capacitor:copy
> node dist/cli-scripts/cap-scripts.js copy

✖ Copying Web App to Electron platform: The "path" argument must be of type string. Received undefined
(node:34948) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:124:11)
    at join (path.js:1039:7)
    at ih (/Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:6:1848)
    at /Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:15:316
    at Et (/Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:6:333)
    at qi (/Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:15:259)
    at /Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:15:551
    at Object.<anonymous> (/Users/dominiquegoncalves/Documents/Code/2021/desktop-test/docent-base/node_modules/@capacitor-community/electron/dist/cli-scripts/cap-scripts.js:15:794)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:34948) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:34948) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have looked through the other issues that mention similar error codes but have not been able to solve this issue. My project was recently an Angular 8 project but needed to upgrade Angular because I needed a higher version of Typescript for @capacitor/filesystem to be used (I am attempting to do setup a filesystem inside of my electron application).

Before the angular upgrade I was able to use all npx cap ... @capacitor-community/electron functions in my cli but since the upgrade I just keep getting the error above.

I am able to run npx cap ... electron and have the application open correctly but it is just a blank screen when the application opens and there's an error in the electron node modules with that path.

I looked into the INIT_CWD env issue mentioned in #76 in my cap-scripts.js file but when I search the file, INIT_CWD is not included in the cap-scripts.js file.

Let me know if any other information is needed. I cannot share code as it is for a client

This application is a hybrid app as we have a web application, mobile (both iOS and Android) as well as Electron desktop app. The Electron desktop app is an offline application, so it does not reference any backend services.

Ionic 5.3.0 Angular 12 typescript 4.3.5 @capacitor-community/electron 4.0.3 @capacitor/core 3.2.4 @capacitor/cli 2.5.0

IT-MikeS commented 3 years ago

Try upgrading the capacitor cli and let me know if that helps at all