Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use -- when the npmClient is pnpm #5020

Open
NatoBoram opened this issue Jun 13, 2023 · 0 comments
Open

Don't use -- when the npmClient is pnpm #5020

NatoBoram opened this issue Jun 13, 2023 · 0 comments
Labels

Comments

@NatoBoram
Copy link

NatoBoram commented Jun 13, 2023

Description:

When running ionic capacitor run android --livereload --external, I get an endless loop of [INFO] Waiting for connectivity with pnpm...

> pnpm run ionic:serve -- --host=0.0.0.0 --port=8100
[pnpm] > [email protected] ionic:serve /home/nato/Code/github.com/Omerlo-Technologies/theia-mobile
[pnpm] > vite dev "--" "--host=0.0.0.0" "--port=8100"
[pnpm]   VITE v4.3.9  ready in 474 ms
[pnpm]   ➜  Local:   http://localhost:5173/
[pnpm]   ➜  Network: use --host to expose
[pnpm]   ➜  press h to show help
[INFO] Waiting for connectivity with pnpm...
[INFO] Waiting for connectivity with pnpm...
[INFO] Waiting for connectivity with pnpm...

The issue is that pnpm run ionic:serve -- --host=0.0.0.0 --port=8100 doesn't work as expected because of that -- in the middle. -- is useful when you want npm to pass additional command-line arguments to scripts, but pnpm isn't limited by this restriction and it passes the whole thing. When vite receives that, it ignores everything after it.

This can be tested:

❯ vite dev --host=0.0.0.0 --port=8100

  VITE v4.3.9  ready in 527 ms

  ➜  Local:   http://localhost:8100/
  ➜  Network: http://192.168.1.213:8100/
  ➜  Network: http://192.168.1.214:8100/
  ➜  press h to show help


❯ vite dev -- --host=0.0.0.0 --port=8100

  VITE v4.3.9  ready in 519 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help

Steps to Reproduce:

  1. Have a Vite app (ex: SvelteKit)
  2. Setup Capacitor and Ionic
{
	"name": "Hello World",
	"integrations": {
		"capacitor": {}
	},
	"type": "custom",
	"npmClient": "pnpm"
}
  1. Set these scripts in package.json
"dev:android": "ionic capacitor run android --livereload --external",
"ionic:serve": "vite dev",
  1. Run pnpm dev:android

Output:

My ionic info:

Ionic:

   Ionic CLI : 7.1.1 (/home/nato/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@ionic/cli)

Capacitor:

   Capacitor CLI      : 5.0.5
   @capacitor/android : 5.0.5
   @capacitor/core    : 5.0.5
   @capacitor/ios     : 5.0.5

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v20.2.0 (/usr/bin/node)
   npm    : 9.7.1
   OS     : Linux 6.2

Other Information:

Admittedly, this could be seen as a vite issue, but I it's possible that they would consider rejecting everything after -- as a security benefit.

@ionitron-bot ionitron-bot bot added the triage label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant