‘vue‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。安装vue无效
2021/7/1 1:20:42
本文主要是介绍‘vue‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。安装vue无效,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
'vue' 不是内部或外部命令,也不是可运行的程序 或批处理文件。安装vue无效
- 问题
- 重新安装vue仍然失败
- 解决
或批处理文件。安装vue无效)
问题
当我用vue创建项目的时候,出现问题,排查后如下:
C:\WINDOWS\system32>vue -v 'vue' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
即win10未识别vue。
重新安装vue仍然失败
于是
C:\WINDOWS\system32>npm install vue -g + vue@2.6.14 updated 1 package in 2.265s
明明已经安装成功了。
但是,在 C:\Users\xxxx\AppData\Roaming\npm目录下,找不到 vue.cmd!!!
这就导致就算我配置了环境变量,系统仍然识别不了 vue 命令
解决
各种百度,各种搜索都不能解决,我都快要卸载node重新安装了。
这时突然灵光一闪,想起安装 vue-cli 的时候的报错信息:
C:\WINDOWS\system32>npm install -g @vue/cli npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm ERR! Unexpected end of JSON input while parsing near '...t":"7.12.1","eslint-f' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\xxxx\AppData\Roaming\npm-cache\_logs\2021-06-30T15_19_25_551Z-debug.log
这个报错是npm版本不对,于是升级npm
C:\WINDOWS\system32>npm install npm -g C:\Users\xxxx\AppData\Roaming\npm\npx -> C:\Users\xxxx\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js C:\Users\xxxx\AppData\Roaming\npm\npm -> C:\Users\xxxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js + npm@7.19.0 added 256 packages from 146 contributors in 18.008s
再安装 vue-cli
C:\WINDOWS\system32>npm install -g @vue/cli npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' added 938 packages, and audited 939 packages in 3m 59 packages are looking for funding run `npm fund` for details 8 vulnerabilities (4 moderate, 4 high) Some issues need review, and may require choosing a different dependency. Run `npm audit` for details.
这时候,vue.cmd终于下载成功了!
vue也能正常使用了
C:\WINDOWS\system32>vue --version @vue/cli 4.5.13
这篇关于‘vue‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。安装vue无效的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04package.json 文件位置在哪?-icode9专业技术文章分享
- 2024-10-01Craco.js学习:从入门到实践指南
- 2024-10-01Create-React-App学习:入门与实践指南
- 2024-10-01CSS-in-JS学习:从入门到实践指南
- 2024-09-30JSX语法学习:从入门到初步掌握
- 2024-09-30Mock.js学习:入门教程与实战演练
- 2024-09-30React Hooks学习:从入门到实践
- 2024-09-30受控组件学习:React中的基础入门教程
- 2024-09-29JS定时器教程:初学者必看指南
- 2024-09-29JS对象教程:初学者的全面指南