我正在尝试学习vuejs。
以管理员身份运行 Power shell。
全局安装:
C:\Windows\system32> npm install -g @vue/cli
此消息出现:
npm 警告已弃用 [email protected] :交叉生成不再需要构建工具链,而是使用它 C:\Users\Computer\AppData\Roaming\npm\vue -> C:\Users\Computer\AppData\Roaming\npm\node_modules@vue\cli\bin\vue.js
> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0e7e7c617a616c7b68647d4e3820362036" rel="noreferrer noopener nofollow">[email protected]</a> postinstall C:\Users\Computer\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\protobufjs
> node scripts/postinstall
> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e30313a3b3331301e6f706f66706f6e" rel="noreferrer noopener nofollow">[email protected]</a> postinstall C:\Users\Computer\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c6a7f697a6962787f4c3d223e223b" rel="noreferrer noopener nofollow">[email protected]</a> (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86e0f5e3f0e3e8f2f5c6b7a8b4a8b1" rel="noreferrer noopener nofollow">[email protected]</a>: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @vue/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8be8e7e2cbb8a5bea5bb" rel="noreferrer noopener nofollow">[email protected]</a>
added 680 packages from 509 contributors in 124.261s
然后我想使用“vue --version”检查它的版本:
C:\Windows\system32> vue --version
vue:术语“vue”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。检查 名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。 行:1 字符:1 + vue --版本 + ~~~ + 类别信息:ObjectNotFound:(vue:字符串)[],CommandNotFoundException + FullQualifiedErrorId:CommandNotFoundException
我尝试过卸载并重新安装。还是行不通。
- 我的节点版本:v10.15.3
- 我的 npm 版本:6.4.1
我应该做什么?
最佳答案
检查您的 AppData/Roaming/npm/node_modules/(等)前缀是否设置正确
输入npm config get prefix
并查看它是否存在。
如果没有,可能会导致您的 -g 软件包安装在其他地方。执行 npm config set prefix C:/users/your_user/AppData/Roaming/npm
,然后尝试安装一些软件包。这可能会解决任何无法识别的依赖关系的发生。
关于powershell - Windows powershell : vue --version 'is not recognized' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55084525/