vue init webpack创建npm err

在这里插入图片描述

npm ERR! Unexpected token < in JSON at position 0 while parsing near '<!DOCTYPE html>
npm ERR! <htm...'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\A\AppData\Roaming\npm-cache\_logs\2020-04-08T10_14_44_732Z-debug.log

就很那啥。。。
每天都在和代码相爱,和bug相杀,又是掉头发的一天。

解决方法一:

  1. 使用淘宝镜像
    npm config set registry https://registry.npm.taobao.org/

  2. 清理npm缓存
    npm cache clean --force

  3. 初始化项目
    vue init webpack myproject
    myproject是我的项目名称
    在这里插入图片描述
    解决方法二:
    手动删除npm-cache文件夹,这个操作和命令( npm cache clean --force)清缓存类似
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_45832807/article/details/105394687