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-service does not run in cmd.exe or Powershell #1119

Closed
mrberggg opened this issue Apr 12, 2018 · 20 comments
Closed

vue-cli-service does not run in cmd.exe or Powershell #1119

mrberggg opened this issue Apr 12, 2018 · 20 comments

Comments

@mrberggg
Copy link

Version

3.0.0-beta.6

Reproduction link

https://gist.github.com/mrberggg/18d54d105f8cbfa64bd03cb63f9fdfdf

Steps to reproduce

Create a new project with vue cli, then navigate to folder.

In bash run vue-cli-service serve or ./node_modules/.bin/vue-cli-service serve. Serve will work properly.

In Powershell/cmd.exe, run vue-cli-service serve. Will show the following error:
'vue-cli-service' is not recognized as an internal or external command

Try running the service manually by running .\node_modules\.bin\vue-cli-service serve. Will pop open Windows' 'How do you want to open this file?' dialog.

What is expected?

Should run correctly in cmd.exe/Powershell.

What is actually happening?

Does not run.

@mrberggg
Copy link
Author

This was an obscure npm edge case, not related to vue-cli. Was using npm in bash on windows to develop, had to test in cmd.exe. Apparently npm only generates .cmd files for Windows when you run npm install from cmd.exe or Powershell. Deleting node_modules and re-installing from cmd.exe fixes this.

@SteffRainville
Copy link

SteffRainville commented May 17, 2018

Similar problem on beta10. had many " vue-loader was used without the corresponding plugin errors" after a clean vue create. Fixed it by using CMD instead of PowerShell

@MTyson
Copy link

MTyson commented Jul 11, 2018

Hm, using git bash on windows isn't an obscure edge case.

It's the only way to develop on windows :)

Oh I see what you are saying, you ran install on cmd and then ran npm command in bash.

@rosdi
Copy link

rosdi commented Aug 27, 2018

Happened to me, it turned out when I run npm install --global @vue/cli it installs vue in Administrator's AppData\Roaming\npm folder instead of the current user's AppData\Roaming\npm folder.

Manually moving the installed files to the current user AppData\Roaming\npm folder fixed it.

@kmc059000
Copy link

Similar problem for me. Deleting node_modules and reinstalling with yarn fixed my problem

@ghost
Copy link

ghost commented May 30, 2019

I have had this problem using windows 7, in my case I run npm i and npm run serve in Visual Studio embebed terminal. The problem was fixed when I deleted node_modules folder and run npm i and npm run serve in cmd.

@zolodeveloper
Copy link

I have had this problem using windows 7, in my case I run npm i and npm run serve in Visual Studio embebed terminal. The problem was fixed when I deleted node_modules folder and run npm i and npm run serve in cmd.

it's so working

@AdamYoung
Copy link

uninstalled / reinstalled Node/NPM, tried all the recommendations here but nothing is working. Can't get vue CLI to execute npm run serve with or without running cmd/powerShell as Administrator on windows 10 ...

@thebeekeeper
Copy link

None of the above worked for me, but I think my problem was related to WSL. Sometimes when I check out a repo using WSL it causes some weird case-sensitivity issues when I try to do things in that directory from cmd. I checked out my project using git in cmd rather than WSL, and everything started to work as expected.

@murray-lang
Copy link

murray-lang commented Oct 24, 2019

My problem was with Visual Studio 2019 build process. I my case I was able to solve it by providing a more complete path to vue-cli-service in package.json. i.e.
`...

"scripts": {
"serve": "node_modules/.bin/vue-cli-service serve",
"build": "node_modules/.bin/vue-cli-service build",
"lint": "node_modules/.bin/vue-cli-service lint"
}
...`
In hindsight probably not of great relevance to this thread, but I got here when looking for a solution to Visual Studio 2019 behaviour with vue projects.

@vikas-ukani
Copy link

npm install --global @vue/cli

I used this command on my bash terminal

And, Then I run vue js app
using command npm start
And, my terminal shows me and error like,

vue-cli-service serve

'vue-cli-service' is not recognized as an internal or external command,
operable program or batch file.

What can i do?

Please, help me,

@and-jan
Copy link

and-jan commented Feb 8, 2020

You can try to delete the node_modules directory and install it again with npm install.
In my case I copied the node_modules directory from a linux installation and apparently windows needs to create its own files.

@gcleaves
Copy link

gcleaves commented Apr 1, 2020

Bitdefender (and perhaps other antivirus software) prevents a Windows process from launching a new console because it blocks access to conhost.exe. Thus npm run serve was failing silently for me. I do not have the option of changing the way Bitdefender works, so I have worked around the problem by using the cygwin console instead of cmd or Powershell.

@sypherwing
Copy link

try running command prompt as administrator if your account is an administrator account, and run npm install --global @vue/cli. if it still doesn't work run npm uninstall --global @vue-cli to uninstall previous versions of Vue. then run npm install --global @vue/cli to install Vue

@LeoXrm
Copy link

LeoXrm commented Jul 21, 2020

"npm i" has fixed the issue for me

@almanalfaruq
Copy link

Still facing the same issue for Windows. I've been trying to delete node_modules inside my project, reinstalling again. Create another vue project. The problem still showing up.
At first, I thought because my vue-cli isn't updated yet, but it seems that npm run <script_name> will use the global modules instead of the one that installed in my project.

Using absolute path to the vue-cli-service (ex: .\node_modules\.bin\vue-cli-service serve via PowerShell) inside the project's node_modules solves the issue for me.

@mhldtna
Copy link

mhldtna commented Jan 20, 2021

On Windows, if you follow the installation instructions and install @vue/cli using the npm install "-g" option, the vue command is installed in c:\Users<your username>\AppData\Roaming\npm. Then when you try to run "vue" the command is not found because it's not in your Windows path. The easy solution is to add "%APPDATA%\npm" to your path.

@william-keller
Copy link

Remember to set the NODE_ENV=development and run npm install again

@astonishqft
Copy link

may be you are in development mode. such as you root dir has an .env file.

https://mp.weixin.qq.com/s/VYFtSfBgz_Bolouz21NaEA

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