Angular-cli: ng set --global pacakgeManager=yarn Unexpected token y in JSON at position 0

Created on 13 Feb 2017  路  5Comments  路  Source: angular/angular-cli

@angular/cli: 1.0.0-beta.31
node: 7.5.0
os: win32 x64 - Windows 10

Repro steps.

Try to set the global packageManger to yarn

ng set --global pacakgeManager=yarn

The log given by the failure.

Unexpected token y in JSON at position 0
SyntaxError: Unexpected token y in JSON at position 0
    at JSON.parse (<anonymous>)
    at resolve (C:\Users\mark.pieszak\AppData\Roaming\npm\node_modules\@angular\cli\commands\set.js:55:39)
    at Class.run (C:\Users\mark.pieszak\AppData\Roaming\npm\node_modules\@angular\cli\commands\set.js:30:16)
    at Class.<anonymous> (C:\Users\mark.pieszak\AppData\Roaming\npm\node_modules\@angular\cli\ember-cli\lib\models\command.js:134:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)

Most helpful comment

Wow I thought something changed in beta31 to cause it. I completely didn't see that typo! You're 100% right, that fixes it 馃憤馃憤

All 5 comments

Not sure if intended but your repro steps have a typo

pacakgeManager
should be:
packageManager

I tried to repo this issue and it worked correctly with the typo change:

Ricardos-MacBook-Pro:Projects ricardovaranda$ ng get packageManager --global
default
Ricardos-MacBook-Pro:Projects ricardovaranda$ ng set packageManager=yarn --global
Ricardos-MacBook-Pro:Projects ricardovaranda$ ng get packageManager --global
yarn

Wow I thought something changed in beta31 to cause it. I completely didn't see that typo! You're 100% right, that fixes it 馃憤馃憤

I encountered this issue without a typo

ng set --global packageManager=yarn
Unexpected token u in JSON at position 0
SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at /Users/andreiluca/Projects/my-app/node_modules/angular-cli/commands/set.js:46:39
    at Promise (<anonymous>)
    at Class.run (/Users/andreiluca/Projects/my-app/node_modules/angular-cli/commands/set.js:31:16)
    at Class.<anonymous> (/Users/andreiluca/Projects/my-app/node_modules/angular-cli/ember-cli/lib/models/command.js:152:17)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

SOLVED: Had more cli versions installed

Same problem, same solution for several cli version. Uninstall from npm.

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

Was this page helpful?
0 / 5 - 0 ratings