Hello, I am having an error running the simple command of ionic serve
natively in Windows. However, ionic cordova build android
works fine in the same shell. This is the error that running ionic serve
in cmd.exe gives:
ionic serve
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] 'sh' is not recognized as an internal or external command,
[ng] operable program or batch file.
However, running ng run app:serve --host=0.0.0.0 --port=8100
directly works just fine…
The ionic serve
command also works properly in Linux through WSL, however the problem with that approach is that node-sass has to be recompiled with Linux bindings to do this.
Any reason why this is happening, or workarounds/fixes?
Thanks!
Also, below is the more detailed error log running ionic serve --verbose
. As can be seen in the log, windows: true
is set. However, for some reason, ionic-cli is still trying to execute sh
commands in a windows environment?
ionic serve --verbose
ionic:lib Terminal info: { tty: true, ci: false, windows: true } +0ms
ionic:lib CLI global options: { _: [ 'serve' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +9ms
ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
ionic:lib:project Project details: { configPath: 'C:\\Users\\json\\Projects\\test\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +2ms
ionic Context: { binPath: 'C:\\Users\\json\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\json\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\Users\\json\\Projects\\test', version: '4.10.2' } +0ms
ionic:lib:telemetry Sending telemetry for command: 'ionic serve' [ '--verbose', '--interactive', '--color' ] +0ms
ionic:lib:hooks Looking for ionic:serve:before npm script. +0ms
ionic:utils-network checking for open port on 0.0.0.0:8100 +0ms
ionic:utils-network checking for open port on fe80::6187:39a0:932:443b:8100 +12ms
ionic:utils-network checking for open port on 169.254.68.59:8100 +2ms
ionic:utils-network checking for open port on fe80::2174:5154:8963:7486:8100 +2ms
ionic:utils-network checking for open port on 192.168.0.30:8100 +4ms
ionic:utils-network checking for open port on ::1:8100 +2ms
ionic:utils-network checking for open port on 127.0.0.1:8100 +1ms
ionic:lib:serve Looking for ionic:serve npm script. +0ms
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] 'sh' is not recognized as an internal or external command,
[ng] operable program or batch file.
ionic:lib:serve received unexpected close for ng (code: 1) +64ms
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
ionic:cli-framework:utils:process onBeforeExit handler: running 1 functions +1ms
ionic:cli-framework:utils:process error while killing process tree for 14276: { Error: Command failed: taskkill /pid 14276 /T /F
ionic:cli-framework:utils:process ERROR: The process "14276" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process at ChildProcess.exithandler (child_process.js:297:12)
ionic:cli-framework:utils:process at ChildProcess.emit (events.js:197:13)
ionic:cli-framework:utils:process at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
ionic:cli-framework:utils:process killed: false,
ionic:cli-framework:utils:process code: 128,
ionic:cli-framework:utils:process signal: null,
ionic:cli-framework:utils:process cmd: 'taskkill /pid 14276 /T /F' } +93ms
ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 14276 /T /F
ionic:cli-framework:utils:process ERROR: The process "14276" not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process at ChildProcess.exithandler (child_process.js:297:12)
ionic:cli-framework:utils:process at ChildProcess.emit (events.js:197:13)
ionic:cli-framework:utils:process at maybeClose (internal/child_process.js:978:16)
ionic:cli-framework:utils:process at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
ionic:cli-framework:utils:process killed: false,
ionic:cli-framework:utils:process code: 128,
ionic:cli-framework:utils:process signal: null,
ionic:cli-framework:utils:process cmd: 'taskkill /pid 14276 /T /F' } +4ms
ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +2ms