无法在Windows 10上安装@vue/cli 3

9
我无法全局或本地安装最新版本的Vue。
对于这两种安装方式,我都遇到了错误。我不明白为什么Node不能被识别为一个命令,因为它对其他包来说运行得很好。
例如,使用vue-cli安装Vue 2是完美的。 我也检查了高级系统中的路径,并将其添加到安装文件夹D:\Nodejs中,包括系统和用户变量。
$ npm install -g @vue/cli
npm WARN deprecated hoek@5.0.4: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\huygh\AppData\Roaming\npm\vue -> C:\Users\huygh\AppData\Roaming\npm\node_modules\@vue\cli\bin\vue.js

> protobufjs@6.8.8 postinstall C:\Users\huygh\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\protobufjs
> node scripts/postinstall

'node' n'est pas reconnu en tant que commande interne
ou externe, un programme ex▒cutable ou un fichier de commandes.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protobufjs@6.8.8 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protobufjs@6.8.8 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\huygh\AppData\Roaming\npm-cache\_logs\2018-12-19T09_25_36_393Z-debug.log

其他类似Angular的软件包可以正常工作。 以下是其他全局软件包:

C:\Users\huygh\AppData\Roaming\npm
+-- @angular/cli@6.2.8
+-- cordova@8.1.2
+-- gulp-cli@2.0.1
+-- ionic@4.5.0
+-- nodemon@1.18.9
+-- npm@6.5.0
+-- npm-check@5.9.0
+-- sass@1.15.2
`-- serve@10.1.1
5个回答

13
在Windows 10上:打开“开始”(Win键)-> 输入:cmd -> 右键单击:命令提示符 -> 选择:以管理员身份运行 -> 输入:npm install -g @vue/cli
注意:在安装之前,请确保您正在运行Node.js版本8.9或更高版本(建议使用8.11.0+)。

尝试过这个程序,运行了半个多小时,但似乎卡住了。 - J E Carter II
1
我也尝试了这个方法,但是没有成功 :( 我使用的是 Node v8.11.3 版本,仍然提示“请使用管理员权限”。 - Erik

3

以上所有回答都不适用于我,因为在我的Windows 7上,通过npm安装vue是不可能的。我只是通过yarn安装了vue cli 3,它完美地工作了。


3

Vue CLI 3似乎存在问题。目前最好还是使用版本2。您可以在这里了解更多有关此问题的信息。


2
我通过使用Windows命令提示符解决了我的问题(目前)。它允许我全局安装并执行npm run serve(在Git Bash中也无法执行)。 - Grégory Huyghe

-1

我使用 Node.js 命令提示符 解决了这个问题。使用普通的 cmd 找不到 vue,但是使用 Node.js 命令提示符 安装 (npm install -g @vue/cli) 和运行它 (vue create example-project) 非常容易。


-1

解决这个问题的一种方法是卸载 Node 并重新安装。 我的意思是,这种方法对我有效。 进入控制面板 -> Node -> 卸载

在安装 Node 之后,第一件事就是安装 Vue CLI - npm install -g @vue/cli


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接