Vue-cli: Vue CLI fails on Windows Powershell

Created on 6 Feb 2019  Â·  15Comments  Â·  Source: vuejs/vue-cli

Version

3.4.0

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (16) x64 AMD Ryzen 7 1700X Eight-Core Processor
  Binaries:
    Node: 11.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Install Vue CLI using npm by running npm i -g @vue/cli
Open powershell as either standard or admin user.
run vue create test in powershell

What is expected?

Vue should run its cli to create a new project without errors

What is actually happening?

Vue CLI fails in only powershell due to apparent syntax errors.
It appears to work fine in cmd.

PS C:\Users\natty> vue create test
At C:\Users\natty\AppData\Local\Yarn\bin\vue.ps1:5 char:13
      *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
              ~
Unexpected token ')' in expression or statement.
At C:\Users\natty\AppData\Local\Yarn\bin\vue.ps1:8 char:3
  if [ -x "$basedir/pwsh" ]; then
    ~
Missing '(' after 'if' in if statement.
At C:\Users\natty\AppData\Local\Yarn\bin\vue.ps1:8 char:5
  if [ -x "$basedir/pwsh" ]; then
      ~
Missing type name after '['.
At C:\Users\natty\AppData\Local\Yarn\bin\vue.ps1:9 char:20
  ... sedir/pwsh"  "$basedir/../Data/global/node_modules/.bin/vue.ps1" "$@"
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"$basedir/../Data/global/node_modules/.bin/vue.ps1"' in expression or statement.
At C:\Users\natty\AppData\Local\Yarn\bin\vue.ps1:9 char:72
  ... sedir/pwsh"  "$basedir/../Data/global/node_modules/.bin/vue.ps1" "$@"
                                                                       ~~~~
Unexpected token '"$@"' in expression or statement.
      CategoryInfo          : ParserError: (:) [], ParseException
      FullyQualifiedErrorId : UnexpectedToken

PS C:\Users\natty>

Most helpful comment

my work-around: Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

All 15 comments

The title of this issue is much more clear than the one of the other duplicate. Also, I don't speak chinese :)

Thanks for the info. The temporary solution is to roll back to yarn 1.12.3 (and reinstall vue cli).

It might be slightly misleading to use NPM in the "Steps to reproduce" when the issue is related to a specific version of Yarn.

Also, to circumvent the issue until it is fixed, you can just call the .cmd-shim directly to avoid the faulty PowerShell-shim, i.e. vue.cmd create test.

I don't know if this is your issue, but I just removed it globally with yarn and re-installed it globally with npm (via admin). Everything works perfectly now; a .ps1 file was not downloaded, leaving the .cmd as the only option.

npm i --global vue-cli

This was giving me a major headache for the past 45 minutes...

I confirm that vue-cli breaks on yarn 1.17.3, seems to be working properly until 1.15.2.

tldr: unless someone wants/is skilled enough to contribute on official yarnpkg for windows, the issue will remain

Tengo el mismo problema y no lo he podido solucionar así

vue : File C:\Users\jason\AppData\Roaming\npm\vue.ps1 cannot be loaded. The file C:\Users\jason\AppData\Roaming\npm\vue.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

This issue seems to have reared its head again, but this time - nothing to do with Yarn. I was bashing my head against the wall because all searches point to Yarn - but:

  1. Remove Node from system entirely, deleting global module folders, also.
  2. Reinstall Node.
  3. "npm install -g @vue/cli" - let it do its thing
  4. Type "Vue" on a powershell window, and you get the error above.

I don't have Yarn in my system, and installed Vue/CLI with NPM. I get this issue. Renaming the vue.ps1 to something else so the "Vue" call uses the .cmd file fixes the issue - but out of the box, the vue cli will not work in PowerShells (the default inside the VS IDE, so that's definitely an issue).

vue : File C:\Users\jason\AppData\Roaming\npm\vue.ps1 cannot be loaded. The file C:\Users\jason\AppData\Roaming\npm\vue.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

This issue seems to have reared its head again, but this time - nothing to do with Yarn. I was bashing my head against the wall because all searches point to Yarn - but:

1. Remove Node from system entirely, deleting global module folders, also.

2. Reinstall Node.

3. "npm install -g @vue/cli"  - let it do its thing

4. Type "Vue" on a powershell window, and you get the error above.

I don't have Yarn in my system, and installed Vue/CLI with NPM. I get this issue. Renaming the vue.ps1 to something else so the "Vue" call uses the .cmd file fixes the issue - but out of the box, the vue cli will not work in PowerShells (the default inside the VS IDE, so that's definitely an issue).

I have the same issue today on a clean system

You can navigate to where the global vue-cli is installed and delete the vue.ps1 file, leaving the vue.cmd file – then things work fine. It’s a work-around for now, I guess.

From: Domenico Marescanotifications@github.com
Sent: Thursday, November 28, 2019 4:33 AM
To: vuejs/vue-clivue-cli@noreply.github.com
Cc: jason-e-grossjason.e.gross@outlook.com; Commentcomment@noreply.github.com
Subject: Re: [vuejs/vue-cli] Vue CLI fails on Windows Powershell (#3424)

vue : File C:\Users\jason\AppData\Roaming\npm\vue.ps1 cannot be loaded. The file C:\Users\jason\AppData\Roaming\npm\vue.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

This issue seems to have reared its head again, but this time - nothing to do with Yarn. I was bashing my head against the wall because all searches point to Yarn - but:

  1. Remove Node from system entirely, deleting global module folders, also.

  2. Reinstall Node.

  3. "npm install -g @vue/cli" - let it do its thing

  4. Type "Vue" on a powershell window, and you get the error above.

I don't have Yarn in my system, and installed Vue/CLI with NPM. I get this issue. Renaming the vue.ps1 to something else so the "Vue" call uses the .cmd file fixes the issue - but out of the box, the vue cli will not work in PowerShells (the default inside the VS IDE, so that's definitely an issue).

I have the same issue today on a clean system

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/vuejs/vue-cli/issues/3424?email_source=notifications&email_token=AD54Y7CFQHOF2ZMFLNL6CPLQV6NADA5CNFSM4GURRP4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFMFSZI#issuecomment-559438181, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD54Y7BQFGC6IJKMKJ377YTQV6NADANCNFSM4GURRP4A.

my work-around: Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

@Hooponopono THANK YOU SO MUCH! That's all I needed, no reinstall nor any other acrobatics ;)

run this command:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

run this command:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Thank you!

run this command:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Thanx!

Having the same Issue, thanks to @Hooponopono. This tip fixed the problem.

Was this page helpful?
0 / 5 - 0 ratings