在npm install的时候会报错,通过上网查阅资料以后,解决方法以下:vue
0、先升级npm版本:npm install -g npm 有多是npm版本太低报错webpack
一、而后清理缓存: npm cache clean --force 可能会有以前遗留代码会产生影响,因此先清理缓存git
二、再执行 npm config set registry http://registry.cnpmjs.org
github
三、再执行 npm install
web
或者直接执行:npm
0、先升级npm版本:npm install -g npm 有多是npm版本太低报错浏览器
一、而后清理缓存: npm cache clean --force 可能会有以前遗留代码会产生影响,因此先清理缓存缓存
二、直接执行命令:npm install --registry=https://registry.npm.taobao.org --loglevel=silly:学习
通过以上步骤完美解决了执行npm install报错的问题;ui
若是仍是报错,能够多几回清除缓存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
*/
下面是个人公众号,你们能够关注一下,能够一块儿学习,一块儿进步: