新建vue项目中遇到的报错信息

在npm install的时候会报错,经过上网查阅资料之后,解决方法如下:

0、先升级npm版本:npm install -g npm   有可能是npm版本过低报错

1、然后清理缓存: npm cache clean --force  可能会有之前遗留代码会产生影响,所以先清理缓存

2、再执行 npm config set registry http://registry.cnpmjs.org

3、再执行 npm install

或者直接执行:

0、先升级npm版本:npm install -g npm  有可能是npm版本过低报错

1、然后清理缓存: npm cache clean --force  可能会有之前遗留代码会产生影响,所以先清理缓存

2、直接执行命令:npm install  --registry=https://registry.npm.taobao.org --loglevel=silly:

经过以上步骤完美解决了执行npm install报错的问题;

如果还是报错,可以多几次清除缓存npm cache clean --force  我清理了三次之后完美解决了。

 

还有一个问题就是:

在正确创建vue项目之后 执行 npm run dev时 无法自动打开新建项目的首页,

解决办法如下:

找到根目录下的config文件夹下的index.js文件

'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')

module.exports = {
dev: {

// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false, //是否默认打开浏览器,默认是false,改为true即可
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,

/**
* Source Maps
*/

 

 

下面是我的公众号,大家可以关注一下,可以一起学习,一起进步:

转载于:https://www.cnblogs.com/lxl0419/p/9481304.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值