vue脚手架创建失败

问题遇到的现象和发生背景

安装Node之后,在文件加下运行npm install -g @vue/cli未创建任何文件

问题相关代码,请勿粘贴截图

npm install -g @vue/cli

运行结果及报错内容

npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated apollo-tracing@0.15.0: The apollo-tracing package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for details
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated graphql-extensions@0.15.0: The graphql-extensions API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/
npm WARN deprecated apollo-cache-control@0.14.0: The functionality provided by the apollo-cache-control package is built in to apollo-server-core starting with Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#cachecontrol for details.
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 subscriptions-transport-ws@0.9.19: The subscriptions-transport-ws package is no longer maintained. We recommend you use graphql-ws instead. For help migrating Apollo software to graphql-ws, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using graphql-ws, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com/ to learn what package you should use instead

changed 897 packages in 20s

我的解答思路和尝试过的方法

之前运行npm init ,有了packge.json,删除这个文件重新npm,继续npm install -g @vue/cli,还是这样,修改了几次环境变量,目前用户变量中path,%NODE_PATH%,系统变量中NODE_PATH:E:\Node,path中%NODE_PATH%,node结构目录E:\Node,下面有E:\Node\node_cache,E:\Node\node_global,E:\Node\node_modules

我想要达到的结果

可以打开vue ui界面

  1. win+r 输入cmd
  2. npm uninstall vue-cli -g
  3. npm install -g @vue/cli
  4. vue --version

    img

  5. node -v

    img

这没问题,有警告很正常,装完用用命令vue --version 查看安装的版本

没有失败,已经安装成功了,使用vue create 项目名 试一下能不能创建项目,如果能就证明已经成功了

可以看我的博客:如何创建vue项目
可以帮你解决脚手架建项目的问题

vue创建是成功的, 如果你使用Vue -V没用,你尝试直接在cmd中查看一下版本