安装vue 时,vue init webpack vue01这步出现错误提示,项目创建不成功呢,请问各位高手该如何解决呢
D:\>vue init webpack vue01
? Project name vue01
? Project description A Vue.js project
? Author
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm
vue-cli · Generated "vue01".
# Installing project dependencies ...
# ========================
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at http://registry.npm.taobao.org/ansi-html reason: Unexpected token < in JSON at position 0
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2021-05-13T09_04_23_439Z-debug.log
# Project initialization finished!
# ========================
To get started:
cd vue01
npm run dev
Documentation can be found at https://vuejs-templates.github.io/webpack
看上去是镜像源的响应有问题,,可以网上搜一个其他的源更换下,有网络条件的也可以直接用 registry.npmjs.org/
hi ,你可以通过这种方式创建,问题会少一些,vue create vue01,再往后可以通过图形化界面来创建更方便,vue ui ,入门文档可以参考:https://cli.vuejs.org/zh/guide/creating-a-project.html, 希望对你有些帮助
好的,多谢哈
关键信息
invalid json response body at http://registry.npm.taobao.org/ansi-html
本地试了一下 这个地址可以正常响应。 应该是 没有 https 响应被篡改或者淘宝那边源的问题。 解决方法就是换一个源或者使用 https 的淘宝源试试