Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue CLI fails on Windows Powershell #3424

Closed
napei opened this issue Feb 6, 2019 · 28 comments
Closed

Vue CLI fails on Windows Powershell #3424

napei opened this issue Feb 6, 2019 · 28 comments

Comments

@napei
Copy link

napei commented Feb 6, 2019

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>
@haoqunjiang
Copy link
Member

Duplicate of #3293 and it is a bug of yarn yarnpkg/yarn#6902

@MartinMa
Copy link

MartinMa commented Feb 7, 2019

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

@Flygenring
Copy link

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.

@xianrusso
Copy link

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

@anaelbe
Copy link

anaelbe commented Aug 31, 2019

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

@billyrtc13
Copy link

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

@jason-e-gross
Copy link

jason-e-gross commented Nov 28, 2019

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

@sermagnus
Copy link

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

@jason-e-gross
Copy link

jason-e-gross commented Nov 28, 2019 via email

@Hooponopono
Copy link

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

@ZeroLiam
Copy link

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

@ale6s
Copy link

ale6s commented Sep 14, 2020

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

@romeumellobr
Copy link

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

Thank you!

@irfanullahshakir
Copy link

irfanullahshakir commented Nov 25, 2020

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

Thanx!

@Noxdor
Copy link

Noxdor commented Dec 16, 2020

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

@saifulbabo67646
Copy link

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

Oh! It's working, Thank You Man

@jzy3d
Copy link

jzy3d commented Nov 5, 2021

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

This one is better since the scope is limited to the current shell. The other proposal seams to disable security checks for the whole user.

@Sina-Naeimi
Copy link

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

thanks for your great answer, That's all I needed😀

@Bouichidarrr
Copy link

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

Thank you man , you save me 😀 .

@peppeg85
Copy link

hello, thanks for the silution but...is there a "less workaround" solution?
thanks anyway!

@tezasn
Copy link

tezasn commented Mar 8, 2022

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.

this is work for me. thanks

@ewitz
Copy link

ewitz commented Apr 7, 2022

What I had to do on Windows 11 (and maybe applies to 10):
1.) Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
2.) npm install -g @vue/cli

@nazimboudeffa
Copy link

Instead of using PowerShell and allow that Policy which may cause a security problem I have useed GitBash and it worked for me

@shus0001
Copy link

thank you ,this help me
run this command: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypas

@Jefh15
Copy link

Jefh15 commented Nov 26, 2022

What I had to do on Windows 11 (and maybe applies to 10): 1.) Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser 2.) npm install -g @vue/cli

ty, this method works for me.

@adhikarisandil32
Copy link

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

so becially I've to memorize that command because everytime I exit the vscode, it's the same error again unless i hit that command again

@Eman93
Copy link

Eman93 commented Feb 18, 2023

What I had to do on Windows 11 (and maybe applies to 10): 1.) Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser 2.) npm install -g @vue/cli

This worked great with me when using VSCode

@16f87
Copy link

16f87 commented Dec 29, 2023

Gracias @Hooponopono!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests