简体   繁体   English

为什么 npm 看不到类星体?

[英]Why npm doesn't see quasar?

I installed quasar with a command: npm install -g @quasar/cli我使用命令安装了 quasar: npm install -g @quasar/cli

Then I tried to create an app folder already with quasar: quasar create callapp然后我尝试使用 quasar 创建一个 app 文件夹: quasar create callapp

The console is run in Visual Studio Code (last version), with administrator rights.控制台在 Visual Studio Code(最新版本)中运行,具有管理员权限。 I have tried reinstalling npm.我已经尝试重新安装 npm。 npm version - 6.9.0 node version - v11.13.0 npm 版本 - 6.9.0 节点版本 - v11.13.0

Installing quasar:安装类星体:

PS C:\Users\Daniels> npm install -g @quasar/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN rm not removing C:\Users\Daniels\AppData\Roaming\npm\quasar.cmd as it wasn't installed by C:\Users\Daniels\AppData\Roaming\npm\node_modules\@quasar\cli
npm WARN rm not removing C:\Users\Daniels\AppData\Roaming\npm\quasar as it wasn't installed by C:\Users\Daniels\AppData\Roaming\npm\node_modules\@quasar\cli
C:\Users\Daniels\AppData\Roaming\npm\quasar -> C:\Users\Daniels\AppData\Roaming\npm\node_modules\@quasar\cli\bin\quasar
+ @quasar/cli@1.0.0
updated 1 package in 14.635s

Creating app:创建应用程序:

PS C:\Users\Daniels> quasar create callapp
quasar : Die Benennung "quasar" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die 
Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:1
+ quasar create callapp
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (quasar:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

So it says that "quasar wasn't found as a name of Cmdlet or function or script of the programm. Please check the path and try again".所以它说“找不到类星体作为 Cmdlet 或 function 或程序脚本的名称。请检查路径并重试”。

I expect that npm just finds quasar cli and I can work with it...我希望 npm 只是找到类星体 cli,我可以使用它......

I solved the problem with deleting node.js, deleting npm, restart of the system, installing another version of node.js (LTS Stable version), installing npm again. I solved the problem with deleting node.js, deleting npm, restart of the system, installing another version of node.js (LTS Stable version), installing npm again.

Windows O/S make sure the "npm" data is part of %path%. Windows O/S确保“npm”数据是 %path% 的一部分。 SET PATH=%PATH%;C:\Users<your-id>\AppData\Roaming\npm SET PATH=%PATH%;C:\Users<your-id>\AppData\Roaming\npm

If you use yarn , run this command to set the path:如果您使用yarn ,请运行以下命令来设置路径:

export PATH="$(yarn global bin):$PATH"

Then, you can use quasar .然后,您可以使用quasar

in windows make sure to check your environment variables.在 windows 中确保检查您的环境变量。 In my case with windows 8.1 environment i have to add manually to PATH在我使用 windows 8.1 环境的情况下,我必须手动添加到 PATH

Environment Variable环境变量

If you installed only the npm like:如果您只安装了 npm,例如:

npm i -g quasar

you need also install the quasar cli:您还需要安装 quasar cli:

npm install -g @quasar/cli

For more info here: https://quasar.dev/quasar-cli/installation欲了解更多信息: https://quasar.dev/quasar-cli/installation

If you are using ps as a command prompt, you should restart ps to use the commands when you add a new package.如果您使用 ps 作为命令提示符,则应在添加新的 package 时重新启动 ps 以使用这些命令。

Here's my solution:-这是我的解决方案:-

  • Install node.js (V16 worked for me)安装 node.js(V16 为我工作)
  • Install Quasar npm install -g @quasar/cli安装 Quasar npm install -g @quasar/cli
  • make sure you access global installed npm packages by adding a path entry in your system variables ie(C:\Users\yourname\AppData\Roaming\npm)确保通过在系统变量中添加路径条目来访问全局安装的 npm 包,即(C:\Users\yourname\AppData\Roaming\npm)

I had the same error message when I want to use quasar testing.当我想使用类星体测试时,我收到了同样的错误信息。 In my case npx was the solution在我的情况下,npx 是解决方案

npx quasar... npx类星体...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM