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

quasar info shows @quasar/cli as undefined inside app folder, shows correct cli version outside app folders #4224

Closed
GordonBlahut opened this issue May 27, 2019 · 13 comments

Comments

@GordonBlahut
Copy link

Software version

Quasar: 1.0.0-rc.2
@quasar/app (v1+ only): 1.0.0-rc.4
@quasar/cli: 1.0.0-rc.2
OS: Windows_NT(10.0.17763) - win32/x64
Node: 10.15.3
NPM: 6.9.0
Yarn: 1.16.0

What did you get as the error?

Inside a Quasar app folder, quasar info shows @quasar/cli as undefined under Global packages and CLI commands such as quasar upgrade are unknown/missing from the command list.

Outside a Quasar app folder, quasar info shows the expected @quasar/cli version and commands.

What were you expecting?

To see the correct @quasar/cli version and be able to run @quasar/cli commands such as quasar upgrade.

What steps did you take, to get the error?

On Windows 10, used npm to install @quasar/cli globally.
quasar create to create the app folder (selected yarn).
quasar info to see quasar info with missing CLI version.

Ran into this because I was trying to do quasar upgrade from a v1.0.0-beta25 project as per the documentation and received

unknown command "upgrade".

Tried reinstalling yarn, node/npm, deleting yarn.lock, deleting node_modules, etc.

@webnoob
Copy link
Contributor

webnoob commented May 27, 2019

I have this exact issue but assumed it was just my environment.

@rstoenescu
Copy link
Member

Can you confirm that you've globally uninstalled the old "quasar-cli" package?

@rstoenescu
Copy link
Member

Also, @GordonBlahut : are you running the command in a genuine terminal or in a code editor terminal?

@webnoob
Copy link
Contributor

webnoob commented May 27, 2019

I've just been through this again and it seems it's working correctly when you use a genuine terminal i.e CMD or GitBash CMD. It's only when I opened Webstorm that it failed. When checking the terminal type in Webstorm (settings | Search "terminal") did it show it was using powershell.

@webnoob
Copy link
Contributor

webnoob commented May 27, 2019

From what I can see, webstorm is prioritizing the locally installed Quasar package over the global one. Running node C:\Users\ME\AppData\Roaming\nvm\v11.9.0\node_modules\@quasar\cli\bin\quasar upgrade in webstorm does work correctly because I'm forcing it to look at the global package which then tries to look for the local package and it all works.

Now I understand where Webstorm is failing, I'll try to find a way around it.

@webnoob
Copy link
Contributor

webnoob commented May 27, 2019

I've got some more information on this now. For webstorm at least, there is an option in Settings | Terminal called:

image

This is enabled by default and I believe registers the local quasar package as the global one (bad!!). Quasar relies on the global one to trigger first and it in turn calls the local app version.

Unticking this option has fixed my issue.

PR'd the docs #4226 and #4227

@GordonBlahut
Copy link
Author

@rstoenescu I am using PowerShell to run commands. If you mean the old pre-v1 CLI, I only ever started with the v1 betas.

@webnoob
Copy link
Contributor

webnoob commented May 28, 2019

@GordonBlahut How have you installed your global deps? Did you use yarn or npm? We always recommend npm for globals npm install -g package and yarn for local deps.

Depending on which version of yarn you're using, you could be falling foul of this issue: yarnpkg/yarn#6902

@rstoenescu
Copy link
Member

@GordonBlahut You're not answering all of our questions. Please read the thread. Are you in the same situation as @webnoob ? Meaning you're using the terminal in a code editor? And which? And make sure it doesn't automatically pick up node_modules/.bin before picking up the global installation of @quasar/cli. Please reopen with these answers if they don't apply to you. Thanks.

@GordonBlahut
Copy link
Author

Sorry it was the middle of the night where I am when some of these questions were asked. I thought I answered everything but I'll confirm below. Let me know if you still need additional information.

Can you confirm that you've globally uninstalled the old "quasar-cli" package?

Are you talking about the ~0.17 version of the package? If so, I never used anything before @quasar/cli-v1.0.0-beta.7. I used npm to upgrade from @quasar/cli-v1.0.0-beta.7 to @quasar/cli-v1.0.0-rc.2

are you running the command in a genuine terminal or in a code editor terminal?

I am running the command using PowerShell. I use Visual Studio 2017 and Visual Studio Code for editing, depending on if I am doing server or client stuff. I do launch the PowerShell process from a context menu in VS 2017 though for convenience.

How have you installed your global deps? Did you use yarn or npm? We always recommend npm for globals npm install -g package and yarn for local deps.

I use npm for globals and yarn for locals.

Depending on which version of yarn you're using, you could be falling foul of this issue: yarnpkg/yarn#6902

I am using Yarn 1.16.0. I did try creating a new app folder using npm for locals just to see if it was a yarn issue for locals and ran into the same issue. If I am understanding that issue correctly, it appears to be an issue when using yarn to install global packages, which I am not doing and appears to have been resolved in 1.15.2 so I don't think this is it.

And make sure it doesn't automatically pick up node_modules/.bin before picking up the global installation of @quasar/cli.

Ah, this appears to be exactly what's happening in my case. .\node_modules\.bin is injected right at the top of my PATH if I launch PowerShell from VS. If I launch PowerShell directly, .\node_modules\.bin is not injected.

Now to figure out why it's doing that and how to change it, but it does not appear to be a Quasar concern, unless you want to detect cases where the local package is invoked without the global one and print warnings or something.

@webnoob
Copy link
Contributor

webnoob commented May 28, 2019

Ah, this appears to be exactly what's happening in my case. .\node_modules.bin is injected right at the top of my PATH if I launch PowerShell from VS

This is what Webstorm was doing as well - I found a setting to control it. Perhaps VS has the same option.

I'm not sure your suggestion is possible as the quasar cli relies on the global one calling the app one not the other way round.

@mpacary
Copy link
Contributor

mpacary commented Jun 21, 2019

Same issue here, with using the genuine terminal (Windows 10 cmd).

Turned out I had to do some cleaning in my PATH env variable. Maybe some editor (I use VS Code) has injected .\node_modules\.bin.

Tip: run command where quasar in your project directory to know where quasar binary is run from 👍

@webnoob
Copy link
Contributor

webnoob commented Jun 21, 2019

@mpacary Thanks for that info
@rstoenescu Do you think it's worth another note on the docs for that part (https://quasar.dev/quasar-cli/cli-documentation/commands-list#upgrade). If the users are using VSCode and don't untick that option in there about the path bu then try to use the normal cmd, they will run into the same issue because it exists the in the %PATH%.

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

4 participants