zoukankan      html  css  js  c++  java
  • 新建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
    */

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

  • 相关阅读:
    poj 2100 尺取法 一个数字拆成连续数字平方和
    poj 1011 dfs+剪枝
    CF-242-C bfs+stl
    hdu 1297 递推
    poj 2104 划分树模板
    poj 3842 全排列+筛素数+暴力
    hdu 1421 经典dp
    hdu 1069 最长上升子序列变形
    hdu 3496 二维费用的01背包
    nyoj 16 最长上升子序列变形
  • 原文地址:https://www.cnblogs.com/lxl0419/p/9481304.html
Copyright © 2011-2022 走看看