linux npm run dist 报错

发布线上测试版本的时候打包出错,前面有打包成功过,现在添加了几个新的文件,报错,想请教如果是文件怎么怎么去排查错误呢
clipboard.png
package.js
clipboard.png
webpack

/*
 * @Author: sunnie.Song 
 * @Date: 2017-12-09 17:02:20 
 * @Last Modified by: sunnie.Song
 * @Last Modified time: 2018-01-13 14:22:50
 */

var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require("html-webpack-plugin");

// 环境变量配置,dev / online
var WEBPACK_ENV = process.env.WEBPACK_ENV || "dev";

// 获取html-webpack-plugin参数的方法
var getHtmlConfig = function(name, title) {
  return {
    template: "./src/view/" + name + ".html",
    filename: "view/" + name + ".html",
    title: title,
    favicon: "./favicon.ico",
    inject: true,
    hash: true,
    chunks: ["common", name]
  };
};
// webpack config
var config = {
  entry: {
    common: ["./src/page/common/index.js"],
    index: ["./src/page/index/index.js"],
    result: ["./src/page/result/index.js"],
    404: ["./src/page/404/index.js"],
    register: ["./src/page/register/index.js"],
    regsuccess: ["./src/page/regsuccess/index.js"],
    login: ["./src/page/login/index.js"],
    "product/search": ["./src/page/product/search/index.js"],
    "product/goodslist": ["./src/page/product/goodslist/index.js"],
    "product/detail": ["./src/page/product/detail/index.js"],
    "product/download": ["./src/page/product/download/index.js"],
    "user-center/index": ["./src/page/user-center/index.js"],
    "user-account/account": ["./src/page/user-account/account/index.js"],
    "user-account/wallet": ["./src/page/user-account/wallet/index.js"],
    "user-account/address": ["./src/page/user-account/address/index.js"],
    "user-account/invoice-setting": [
      "./src/page/user-account/invoice-setting/index.js"
    ],
    "user-account/set-pwd": ["./src/page/user-account/set-pwd/index.js"],
    "user-account/reset-pwd": ["./src/page/user-account/reset-pwd/index.js"],
    "user-account/forget-pwd": ["./src/page/user-account/forget-pwd/index.js"],
    "user-account/bind-phone": ["./src/page/user-account/bind-phone/index.js"],
    "user-account/change-phone": [
      "./src/page/user-account/change-phone/index.js"
    ],
    "user-account/bind-email": ["./src/page/user-account/bind-email/index.js"],
    "user-account/change-email": [
      "./src/page/user-account/change-email/index.js"
    ],
   //    "user-account/certification": [
   //    "./src/page/user-account/certification/index.js"
   //  ],
   // "user-account/set-pay": ["./src/page/user-account/set-pay/index.js"],
    "user-message/service": ["./src/page/user-message/service/index.js"],
    "user-trade/order": ["./src/page/user-trade/order/index.js"],
    
     // "user-trade/orderdetail": ["./src/page/user-trade/orderdetail/index.js"],
    "user-trade/confirm": ["./src/page/user-trade/confirm/index.js"],
    "user-refund/apply": ["./src/page/user-refund/apply/index.js"],
    "cart/index": ["./src/page/cart/index/index.js"],
    "cart/confirm-order": ["./src/page/cart/confirm-order/index.js"],
    "cart/confirm-order-success": [
      "./src/page/cart/confirm-order-success/index.js"
    ]
  },
  output: {
    path: __dirname + "/dist/",
    publicPath: "//www.sportjx.com/dist/",
    filename: "js/[name].js"
  },
  externals: {
    jquery: "window.jQuery"
  },
  module: {
    loaders: [
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract("style-loader", "css-loader")
      },
      {
        test: /\.(gif|png|jpg|woff|svg|eot|ttf)\??.*$/,
        loader: "url-loader?limit=100&name=resource/[name].[ext]"
      },
      {
        test: /\.string$/,
        loader: "html-loader",
        query: {
          minimize: true,
          removeAttributeQuotes: false
        }
      }
    ]
  },
  resolve: {
    alias: {
      node_modules: __dirname + "/node_modules",
      util: __dirname + "/src/util",
      page: __dirname + "/src/page",
      service: __dirname + "/src/service",
      image: __dirname + "/src/image",
      fonts: __dirname + "/src/fonts"
    }
  },
  plugins: [
    // 独立通用模块到js/base.js
    new webpack.optimize.CommonsChunkPlugin({
      name: "common",
      filename: "js/base.js"
    }),
    //  new webpack.HotModuleReplacementPlugin(),
    // 把css单独打包到文件里
    new ExtractTextPlugin("css/[name].css"),
    // html模板的处理
  
    new HtmlWebpackPlugin(getHtmlConfig("index", "首页")),
    new HtmlWebpackPlugin(getHtmlConfig("result", "操作结果")),
    new HtmlWebpackPlugin(getHtmlConfig("404", "出差错了")),
    new HtmlWebpackPlugin(getHtmlConfig("register", "注册")),
    new HtmlWebpackPlugin(getHtmlConfig("regsuccess", "注册成功")),
    new HtmlWebpackPlugin(getHtmlConfig("login", "登录")),
    new HtmlWebpackPlugin(getHtmlConfig("product/search", "商品搜索列表")),
    new HtmlWebpackPlugin(getHtmlConfig("product/download", "库存下载")),
    new HtmlWebpackPlugin(getHtmlConfig("product/goodslist", "商品列表")),
    new HtmlWebpackPlugin(getHtmlConfig("product/detail", "商品详情")),
    new HtmlWebpackPlugin(getHtmlConfig("user-center/index", "我的云商操作台")),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/account", "账号管理-我的云商操作台")
    ),
    new HtmlWebpackPlugin(getHtmlConfig("user-account/wallet", "余额账号-我的云商操作台")),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/address", "收货地址-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/invoice-setting", "开票设置-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/set-pwd", "设置密码-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/reset-pwd", "修改密码-我的云商操作台")
    ),

    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/forget-pwd", "忘记密码-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/bind-phone", "绑定手机-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/change-phone", "修改手机-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/bind-email", "绑定邮箱-我的云商操作台")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/change-email", "修改邮箱-我的云商操作台")
    ),
   //  new HtmlWebpackPlugin(
   //   getHtmlConfig("user-account/set-pay", "设置余额密码-我的云商操作台")
   // ),
   //   new HtmlWebpackPlugin(
   //    getHtmlConfig("user-account/certification", "实名认证-我的云商操作台")
   //  ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-message/service", "服务消息-我的云商操作台")
    ),
    new HtmlWebpackPlugin(getHtmlConfig("user-trade/order", "交易订单-我的云商操作台")),
    //   new HtmlWebpackPlugin(getHtmlConfig("user-trade/orderdetail", "订单详情")),
    new HtmlWebpackPlugin(getHtmlConfig("user-trade/confirm", "确认收货")),
    new HtmlWebpackPlugin(getHtmlConfig("user-refund/apply", "申请售后")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/index", "购物车")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/confirm-order", "确认订单")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/confirm-order-success", "提交订单成功"))
  ]
  /* devServer: {
    contentBase: __dirname + "/dist/view", // 当前服务器监听的路径
    hot: true, // 热更新
    port: 8088, // 定义端口号
    host: "localhost",
    open: true // 是否自动打开浏览器
  }*/
};

if ("dev" === WEBPACK_ENV) {
  config.entry.common.push("webpack-dev-server/client?http://localhost:8088/");
}

module.exports = config;
阅读 2.3k
1 个回答

查看 linux 下的npm 和 node版本,升级到最新版本。
删除 node_modules 文件夹,重新安装。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题