新建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
*/

 

 

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

posted @ 2018-08-15 14:42  夏目友人喵  阅读(3033)  评论(0编辑  收藏  举报