Ionic4 Unknown browser query

南笙酒味 提交于 2020-04-30 05:20:20

问题


I have practised Ionic a lot so these Problems are not new for me but I am unabale to solve this one. I am currently trying to migrate my Ionic3 project to Ionic4. To do this I have created a new Ionic4 tabs project.

Every time I try the Ionic serve command I am getting: [ng] An unhandled exception occurred: Unknown browser query

basedir=$(dirname "$(echo "$0" | sed -e 's

Maybe you are using old Browserslist or made typo in query.

[ng] See "C:\Users\Admin\AppData\Local\Temp\ng-9er5Id\angular-errors.log" for further details.
[ERROR] ng has unexpectedly closed (exit code 127).


The Log file:
[error] BrowserslistError: Unknown browser query `basedir=$(dirname "$(echo "$0" | sed -e 's`. Maybe you are using old Browserslist or made typo in query.
    at unknownQuery (D:\Wisex\Technik\Client\safehome_client\node_modules\browserslist\index.js:204:10)
    at D:\Wisex\Technik\Client\safehome_client\node_modules\browserslist\index.js:296:11
    at Array.reduce (<anonymous>)
    at resolve (D:\Wisex\Technik\Client\safehome_client\node_modules\browserslist\index.js:237:18)
    at browserslist (D:\Wisex\Technik\Client\safehome_client\node_modules\browserslist\index.js:361:16)
    at new BuildBrowserFeatures (D:\Wisex\Technik\Client\safehome_client\node_modules\@angular-devkit\build-angular\src\utils\build-browser-features.js:17:35)
    at generateWebpackConfig (D:\Wisex\Technik\Client\safehome_client\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:24:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Does anyone of you have an possible solution for this. I am really greatful for help cause I takes my days to migrate by now.

Yours, Benjamin


回答1:


Do you have the last version of the angular cli?

npm install -g @angular/cli

It might also be useful to post the log




回答2:


I have spent several hours to fix this .Hope it will help someone

Kindly follow the below steps:

  1. find your npm path from the environmental variable. And copy that path and paste it in notepad

2.Go to control panel ->uninstall the node js

3.after uninstalling,restart the system.

4.Now go to npm path in file explorer.

5.And delete the folder named npm and npm-cache

6.And now install the node(LTS version) and angular(refer from the below link for step by step installation)

https://www.zeolearn.com/magazine/setup-angular-windows

note:Dont run the cmd as administrator.Unless ,the installation fails

7.Once you verified that angular is running fine using ng serve -o

8.Install the ionic by npm install -g ionic@latest

9.And run ionic serve.

10.Hope it helps.Happy coding :)



来源:https://stackoverflow.com/questions/57961636/ionic4-unknown-browser-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!