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

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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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.<anonymous> (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)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

@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.

@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.<anonymous> (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.<anonymous> (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).`

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 (<anonymous>) 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.<anonymous> (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.<anonymous> (E:\DAVSProjects\testing\angular-frontend\node_modules \postcss-merge-rules\dist\lib\ensureCompatibility.js:7:19) at Module._compile (module.js:635:30)