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

[bug] 2.0.0-rc.5 with Angular/ng serve not working on Windows #10737

Closed
cjacobemotic opened this issue Aug 22, 2024 · 2 comments
Closed

[bug] 2.0.0-rc.5 with Angular/ng serve not working on Windows #10737

cjacobemotic opened this issue Aug 22, 2024 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@cjacobemotic
Copy link

cjacobemotic commented Aug 22, 2024

Describe the bug

On Windows 10. I wanted to try android development with the alpha 2.0.0 and Angular front-end

Env :

  • Windows 10
  • Node : 20.16.0
  • npm : 10.8.1
  • CLI : Powershell 7.4.2

What I have done :

  • Create a new project with tauri cli and use last alpha (2.0.0-rc,5) :
    $env:CTA_ARGS="--rc"; irm https://create.tauri.app/ps | iex
  • cd tauri-angular
  • npm i
  • npm run tauri dev

Error :
`npm run tauri dev

tangular@0.1.0 tauri
tauri dev
Running BeforeDevCommand (npm run start -- --host $HOST --public-host $HOST)
tangular@0.1.0 start
ng serve --host $HOST --public-host $HOST

Warning: This is a simple server for use in testing or debugging Angular applications
locally.....

An unhandled exception occurred: getaddrinfo ENOTFOUND $HOST
See "C:\Users\C9D91~1.JAC\AppData\Local\Temp\ng-sBWwg8\angular-errors.log" for further details.
Error The "beforeDevCommand" terminated with a non-zero status code.`


Looks like the HOST env variable is not available to the command but as it's tauri cli trying to launch it, I can't do much to set up HOST, I tried to set it before running the command like:
$env:HOST='localhost:4200'; npm run tauri dev

I also tried to use Git Bash shell, but same error.
I also used WSL, to have a try on Ubuntu. I don't have that issue.

As npm run tauri dev don't succeed to launch ng serve, npm run tauri android dev does'nt work either

Reproduction

  • Create a new project with tauri cli and use last alpha (2.0.0-rc,5) :
    $env:CTA_ARGS="--rc"; irm https://create.tauri.app/ps | iex
  • cd tauri-angular
  • npm i
  • npm run tauri dev

Expected behavior

To launch the application

Full tauri info output

npm run tauri info

> tangular@0.1.0 tauri
> tauri info


[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 127.0.2651.105
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.16.0
    - npm: 10.8.1

[-] Packages
    - tauri [RUST]: 2.0.0-rc.5
    - tauri-build [RUST]: 2.0.0-rc.5
    - wry [RUST]: 0.42.0
    - tao [RUST]: 0.29.1
    - @tauri-apps/api [NPM]: 2.0.0-rc.2
    - @tauri-apps/cli [NPM]: 2.0.0-rc.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist/tangular/browser
    - devUrl: http://localhost:1420/
    - framework: Angular
    - bundler: Webpack

Stack trace

npm run tauri dev

> tangular@0.1.0 tauri
> tauri dev

    Running BeforeDevCommand (`npm run start -- --host $HOST --public-host $HOST`)

> tangular@0.1.0 start
> ng serve --host $HOST --public-host $HOST


Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or       
computer. Using a different host than the one passed to the "--host" flag might result in      
websocket connection issues. You might need to use "--disable-host-check" if that's the        
case.
    
An unhandled exception occurred: getaddrinfo ENOTFOUND $HOST
See "C:\Users\C9D91~1.JAC\AppData\Local\Temp\ng-sBWwg8\angular-errors.log" for further details.
    Error The "beforeDevCommand" terminated with a non-zero status code.


-------------------------
npm run tauri android dev                          
 
> tangular@0.1.0 tauri
> tauri android dev

Detected Android emulators:
  [0] Pixel_3a_API_34_extension_level_7_x86_64
  [1] Pixel_6a_API_31
  Enter an index for a emulator above.
Emulator: 1
    Info Starting emulator Pixel_6a_API_31
    Info Waiting for emulator to start...
    Info Waiting for emulator to start...
    Info Waiting for emulator to start...
    Info Waiting for emulator to start... (maybe the emulator is unauthorized or offline, run `adb devices` to check)
    Info Waiting for emulator to start... (maybe the emulator is unauthorized or offline, run `adb devices` to check)
    Info Waiting for emulator to start... (maybe the emulator is unauthorized or offline, run `adb devices` to check)
    Info Waiting for emulator to start... (maybe the emulator is unauthorized or offline, run `adb devices` to check)
    Info Detected connected device: Pixel_6a_API_31 (sdk_gphone64_x86_64) with target "x86_64-linux-android"
    Running BeforeDevCommand (`npm run start -- --host $HOST --public-host $HOST`)

> tangular@0.1.0 start
> ng serve --host $HOST --public-host $HOST


Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or       
computer. Using a different host than the one passed to the "--host" flag might result in      
websocket connection issues. You might need to use "--disable-host-check" if that's the        
case.
    
An unhandled exception occurred: getaddrinfo ENOTFOUND $HOST
See "C:\Users\C9D91~1.JAC\AppData\Local\Temp\ng-IH06Hy\angular-errors.log" for further details.
    Error The "beforeDevCommand" terminated with a non-zero status code.

Additional context

Powershell version :
$PsVersionTable.PSVersion

Major Minor Patch PreReleaseLabel BuildLabel


7 4 2
No response

@cjacobemotic cjacobemotic added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 22, 2024
@cjacobemotic cjacobemotic changed the title [bug] [bug] 2.0.0-rc.5 with Angular/ng serve not working on Windows Aug 22, 2024
@maciekbartczak
Copy link

maciekbartczak commented Aug 28, 2024

I do for belive that at least for the desktop target this is a bug in create-tauri-app tauri-apps/create-tauri-app#765
The fix that has worked for me is to edit the src-tauri/tauri.conf.json file and replace
"beforeDevCommand": "pnpm start --host $HOST --public-host $HOST" with "beforeDevCommand": "pnpm start"

@amrbashir
Copy link
Member

fix in tauri-apps/create-tauri-app#768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants