angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng serve contains error Unknown browser query `basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")`

Open gegejosper opened this issue 9 years ago • 15 comments

Hey! It takes me lots of time doing uninstalling and reinstalling angular-cli but all of this is not luck it keeps giving me this error

Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

Please help! I cannot continue learning without this? Does anyone knows any alternative to do a live test?

angular-cli: 1.0.0-beta.28.3 node: 6.9.5 os: win32 x64 @angular/common: 2.4.8 @angular/compiler: 2.4.8 @angular/core: 2.4.8 @angular/forms: 2.4.8 @angular/http: 2.4.8 @angular/platform-browser: 2.4.8 @angular/platform-browser-dynamic: 2.4.8 @angular/router: 3.4.8 @angular/compiler-cli: 2.4.8

Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") BrowserslistError: Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") at error (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\browserslist\index.js:37:11) at C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\browserslist\index.js:222:9 at Array.forEach (native) at browserslist (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\browserslist\index.js:196:13) at cleanBrowsersList (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\caniuse-api\dist\utils.js:56:59) at setBrowserScope (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\caniuse-api\dist\index.js:30:43) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\caniuse-api\dist\index.js:92:1) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\postcss-merge-rules\dist\lib\ensureCompatibility.js:7:19) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\postcss-merge-rules\dist\index.js:21:28) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\cssnano\dist\index.js:113:26) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\models\webpack-configs\styles.js:6:15) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\models\webpack-configs\index.js:8:10) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\models\webpack-config.js:4:25) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\tasks\serve.js:11:24) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\commands\serve.run.js:6:15) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Class.run (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\commands\serve.js:67:16) at Class. (C:\Users\gegej\Desktop\EasyWayProjects\AngularLearning\AppWork\node_modules\angular-cli\ember-cli\lib\models\command.js:134:17) at process._tickCallback (internal/process/next_tick.js:103:7)

gegejosper avatar Feb 27 '17 18:02 gegejosper

Hi @gegejosper.

The error about the browser is very weird indeed.

Do you have Chrome installed? If not, can you try installing it?

One more thing.

The CLI package name has changed. Try upgrading correctly to the latest version like this:

npm uninstall --global angular-cli
npm cache clean
npm install --global @angular/cli

Try this before making any other change.

Meligy avatar Feb 28 '17 04:02 Meligy

Dupe of https://github.com/angular/angular-cli/issues/3938

filipesilva avatar Mar 14 '17 12:03 filipesilva

not working

Anindo94 avatar Dec 19 '17 17:12 Anindo94

Same error i am getting:

Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") BrowserslistError: Unknown browser query basedir=$(dirname "$(echo "$0" | sed - e 's,\\,/,g')") at error (E:\DAVSProjects\testing\angular-frontend\node_modules\browserslist \index.js:37:11) at E:\DAVSProjects\testing\angular-frontend\node_modules\browserslist\index. js:222:9 at Array.forEach () at browserslist (E:\DAVSProjects\testing\angular-frontend\node_modules\brows erslist\index.js:196:13) at cleanBrowsersList (E:\DAVSProjects\testing\angular-frontend\node_modules
caniuse-api\dist\utils.js:56:59) at setBrowserScope (E:\DAVSProjects\testing\angular-frontend\node_modules\ca niuse-api\dist\index.js:29:43) at Object. (E:\DAVSProjects\testing\angular-frontend\node_modules \caniuse-api\dist\index.js:91:1) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (E:\DAVSProjects\testing\angular-frontend\node_modules \postcss-merge-rules\dist\lib\ensureCompatibility.js:7:19) at Module._compile (module.js:635:30)

anilkumarkatta204 avatar Dec 27 '17 16:12 anilkumarkatta204

@anilkumarkatta204 search for browserlist and browserlist.cmd file in your node_modules or outside the node_modules if you able to find that delete that from there and again apply ng serve and it will work fine if still not work you can ask me.

Anindo94 avatar Dec 28 '17 04:12 Anindo94

no need to uninstall or install the angular cli in your system it will only create a burden and confusion if any warning is coming just ignore it

Anindo94 avatar Dec 28 '17 04:12 Anindo94

@Anindo94 I don't find any file name with browserlist & browserlist.cmd

anilkumarkatta204 avatar Dec 29 '17 05:12 anilkumarkatta204

you have account in skype you can add me and i will guide you from there my username Anindo Kumar

Anindo94 avatar Dec 29 '17 06:12 Anindo94

search for browserlist and browserlist.cmd in the search bar you will get

Anindo94 avatar Dec 29 '17 07:12 Anindo94

I didnt find either files in the whole app either but downgrading bootstrap did solve the issue for me.

ghost avatar Dec 30 '17 12:12 ghost

@iconicsammy that will also worked but i did my deleting the browserlist and browserlist.cmd

Anindo94 avatar Dec 30 '17 16:12 Anindo94

@Anindo94 found the browserlist folder but not browserlist.cmd. (actually, after writing this post, I did find it and it solved! Its on the root project folder, not node_modules. And browserlist is a file, not a folder. So you can do this or that below).

According to that npm package readme:

Queries Browserslist will use browsers query from one of this sources:

  1. Tool options. For example browsers option in Autoprefixer.
  2. BROWSERSLIST environment variable.
  3. browserslist config file in current or parent directories.
  4. .browserslistrc config file in current or parent directories.
  5. browserslist key in package.json file in current or parent directories. We recommend this way.
  6. If the above methods did not produce a valid result Browserslist will use defaults: > 1%, last 2 versions, Firefox ESR.

bernardoadc avatar Feb 06 '18 03:02 bernardoadc

It is worked for me. Thank you @Anindo94

divefox avatar Apr 10 '18 02:04 divefox

@anilkumarkatta204 search for browserlist and browserlist.cmd file in your node_modules or outside the node_modules if you able to find that delete that from there and again apply ng serve and it will work fine if still not work you can ask me.

After deleted browserlist and browserlist.cmd file Still Errors coming: `[ng] Cannot find module 'browserslist' [ng] Error: Cannot find module 'browserslist'

[ng] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) [ng] at Function.Module._load (internal/modules/cjs/loader.js:562:25) [ng] at Module.require (internal/modules/cjs/loader.js:690:17) [ng] at require (internal/modules/cjs/helpers.js:25:18) [ng] at Object. (F:\HybridMobileApp\latest\Pdf_Viewer\node_modules\autoprefixer\lib\autoprefixer.js:3:20) [ng] at Module._compile (internal/modules/cjs/loader.js:776:30) [ng] at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) [ng] at Module.load (internal/modules/cjs/loader.js:653:32) [ng] at tryModuleLoad (internal/modules/cjs/loader.js:593:12) [ng] at Function.Module._load (internal/modules/cjs/loader.js:585:3) [ng] at Module.require (internal/modules/cjs/loader.js:690:17) [ng] at require (internal/modules/cjs/helpers.js:25:18) [ng] at Object. (F:\HybridMobileApp\latest\Pdf_Viewer\node_modules@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\styles.js:13:22) [ng] at Module._compile (internal/modules/cjs/loader.js:776:30) [ng] at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) [ng] at Module.load (internal/modules/cjs/loader.js:653:32)

[ERROR] ng has unexpectedly closed (exit code 1).`

manzooralam avatar Jun 28 '19 12:06 manzooralam

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.