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

Error on build: parseQuery should get a string as first argument

Open Meligy opened this issue 10 years ago • 13 comments

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OSX Sierra

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: local (v1.0.0-beta.16, branch: master)
node: 6.6.0
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

ng new test-app --link-cli
cd test-app
ng build

The log given by the failure.

Normally this include a stack trace and some more information.

At the end of the output I see:

ERROR in ./src/main.ts
Module build failed: Error: parseQuery should get a string as first argument
    at Object.parseQuery (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-utils/index.js:68:9)
    at compiler (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:35:45)
    at Object.loader (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:18:18)
 @ multi main

Looking further up:

 10% building modules 3/6 modules 3 active ...ode_modules/style-loader/addStyles.jsError: parseQuery should get a string as first argument
    at Object.parseQuery (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-utils/index.js:68:9)
    at compiler (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:35:45)
    at Object.loader (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:18:18)
    at LOADER_EXECUTION (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:114:14)
    at runSyncOrAsync (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:115:4)
    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:224:2)
    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:213:10)
    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:228:3
    at Object.context.callback (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:106:13)
    at Object.module.exports (/Users/Meligy/Code/github/angular/angular-cli/node_modules/angular2-template-loader/index.js:32:10)
    at LOADER_EXECUTION (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:114:14)
    at runSyncOrAsync (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:115:4)
    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:224:2)
    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:197:4
    at Storage.finished (/Users/Meligy/Code/github/angular/angular-cli/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:39:16)
    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) 'Error: parseQuery should get a string as first argument\n    at Object.parseQuery (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-utils/index.js:68:9)\n    at compiler (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:35:45)\n    at Object.loader (/Users/Meligy/Code/github/angular/angular-cli/node_modules/awesome-typescript-loader/src/index.ts:18:18)\n    at LOADER_EXECUTION (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:114:14)\n    at runSyncOrAsync (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:115:4)\n    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:224:2)\n    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:213:10)\n    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:228:3\n    at Object.context.callback (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:106:13)\n    at Object.module.exports (/Users/Meligy/Code/github/angular/angular-cli/node_modules/angular2-template-loader/index.js:32:10)\n    at LOADER_EXECUTION (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:114:14)\n    at runSyncOrAsync (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:115:4)\n    at iterateNormalLoaders (/Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:224:2)\n    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/loader-runner/lib/LoaderRunner.js:197:4\n    at Storage.finished (/Users/Meligy/Code/github/angular/angular-cli/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:39:16)\n    at /Users/Meligy/Code/github/angular/angular-cli/node_modules/graceful-fs/graceful-fs.js:78:16\n    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)'
1060ms building modules 

Mention any other details that might be useful.

This is with linked CLI post beta-16.

I discovered it at 790a1b42cea7c9de66cf615556782832af3aa9b7 andI kept running git checkout for earlier commits till f6a39b26c7ea58d7da3d476a3a028d22d442cf46 to avoid the problem and it's still there. Now not sure where it starts.


Thanks! We'll be in touch soon.

Meligy avatar Oct 03 '16 03:10 Meligy

I believe this was related to webpack .25 and font awesome. Adding this to the config fixed it for me.

"loader-utils": "^0.2.16"

DeWitt-A avatar Oct 03 '16 20:10 DeWitt-A

I can't repro this myself, and as far as I can tell webpack.25 is using that version of loader-utils: https://github.com/webpack/webpack/blob/master/package.json#L14

You seem to be using the master branch, did you made sure to clear your node_modules and reinstall? Sometimes versions can get stale, or some other package might have busted semver.

filipesilva avatar Oct 09 '16 00:10 filipesilva

@filipesilva, I am getting the same error when i got add "--aot" to the "ng serve" command. If i continue to use with "--aot", I am getting "missing app.module.ngFactory.ts file" error. However, if i rerun the ng serve after each modifications everything is working fine.

My angular-cli version is "beta17" & os is "sierra".

CarreraPHP avatar Oct 09 '16 11:10 CarreraPHP

I am getting below error with "ng build --prod". screen shot 2016-10-09 at 5 11 49 pm

CarreraPHP avatar Oct 09 '16 11:10 CarreraPHP

@CarreraPHP try updating to beta.17 by following https://github.com/angular/angular-cli#updating-angular-cli. I think this is related with stale dependencies.

filipesilva avatar Oct 10 '16 13:10 filipesilva

@filipesilva, Thank you.

The error didn't occur until now post the cache clean and install as mentioned in the URI provided by U.

Do i need to follow the same steps even when i clone the repo and use "npm link" inside the clone & "npm link angular-cli" inside the project?

CarreraPHP avatar Oct 10 '16 19:10 CarreraPHP

I wouldn't advise you doing that for your projects. There's a bug with npm link where dependencies can be lost when doing npm install.

Regardless, even when using master version, packages need to be kept up to date.

filipesilva avatar Oct 10 '16 19:10 filipesilva

Any temporary solution for this?

theunreal avatar Oct 11 '16 10:10 theunreal

I'm unable to reproduce this.

Here's what I recommend you do to test it:

  • Go to the folder where you cloned the CLI, ensure you are on master branch and reset changes, and git pull

  • Then in the same folder, delete node_modules folder, then run:

    npm cache clear
    npm install
    npm link
    
  • Then go to a completely different folder outside the repo, and run the actual test:

    ng new test-app-fixed --link-cli
    cd test-app-fixed
    ng build
    

For the record, I ran this on macOS Sierra, with this Node version reported by ng --version:

angular-cli: local (v1.0.0-beta.17, branch: master)
node: 6.6.0
os: darwin x64

(NPM 3.10.8)

Meligy avatar Oct 11 '16 11:10 Meligy

@DeWitt-A your solution worked for me, thanks!

In case anyone wants to fix this just go to your package.json and on your dependencies add loader-utils fixed to 0.2.16.

"devDependencies": {
    "@angular/compiler-cli": "2.2.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.21",
    "codelyzer": "~1.0.0-beta.3",
    "commitizen": "^2.8.6",
    "ghooks": "^1.3.2",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "semantic-release": "^6.3.2",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "loader-utils": "0.2.16",
    "webdriver-manager": "10.2.5"
}

Elecash avatar Dec 06 '16 10:12 Elecash

Are you still seeing this with latest beta 22-*?

Meligy avatar Dec 06 '16 11:12 Meligy

@Meligy no, we had a problem with beta.22-* so we're still using beta.21, but I'll give it a try with beta.22 when we can make it work.

Elecash avatar Dec 06 '16 11:12 Elecash

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.