鍍金池/ 問(wèn)答/Linux  網(wǎng)絡(luò)安全  HTML/ linux npm run dist 報(bào)錯(cuò)

linux npm run dist 報(bào)錯(cuò)

發(fā)布線上測(cè)試版本的時(shí)候打包出錯(cuò),前面有打包成功過(guò),現(xiàn)在添加了幾個(gè)新的文件,報(bào)錯(cuò),想請(qǐng)教如果是文件怎么怎么去排查錯(cuò)誤呢
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");

// 環(huán)境變量配置,dev / online
var WEBPACK_ENV = process.env.WEBPACK_ENV || "dev";

// 獲取html-webpack-plugin參數(shù)的方法
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: "http://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: [
    // 獨(dú)立通用模塊到j(luò)s/base.js
    new webpack.optimize.CommonsChunkPlugin({
      name: "common",
      filename: "js/base.js"
    }),
    //  new webpack.HotModuleReplacementPlugin(),
    // 把css單獨(dú)打包到文件里
    new ExtractTextPlugin("css/[name].css"),
    // html模板的處理
  
    new HtmlWebpackPlugin(getHtmlConfig("index", "首頁(yè)")),
    new HtmlWebpackPlugin(getHtmlConfig("result", "操作結(jié)果")),
    new HtmlWebpackPlugin(getHtmlConfig("404", "出差錯(cuò)了")),
    new HtmlWebpackPlugin(getHtmlConfig("register", "注冊(cè)")),
    new HtmlWebpackPlugin(getHtmlConfig("regsuccess", "注冊(cè)成功")),
    new HtmlWebpackPlugin(getHtmlConfig("login", "登錄")),
    new HtmlWebpackPlugin(getHtmlConfig("product/search", "商品搜索列表")),
    new HtmlWebpackPlugin(getHtmlConfig("product/download", "庫(kù)存下載")),
    new HtmlWebpackPlugin(getHtmlConfig("product/goodslist", "商品列表")),
    new HtmlWebpackPlugin(getHtmlConfig("product/detail", "商品詳情")),
    new HtmlWebpackPlugin(getHtmlConfig("user-center/index", "我的云商操作臺(tái)")),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/account", "賬號(hào)管理-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(getHtmlConfig("user-account/wallet", "余額賬號(hào)-我的云商操作臺(tái)")),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/address", "收貨地址-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/invoice-setting", "開(kāi)票設(shè)置-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/set-pwd", "設(shè)置密碼-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/reset-pwd", "修改密碼-我的云商操作臺(tái)")
    ),

    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/forget-pwd", "忘記密碼-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/bind-phone", "綁定手機(jī)-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/change-phone", "修改手機(jī)-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/bind-email", "綁定郵箱-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-account/change-email", "修改郵箱-我的云商操作臺(tái)")
    ),
   //  new HtmlWebpackPlugin(
   //   getHtmlConfig("user-account/set-pay", "設(shè)置余額密碼-我的云商操作臺(tái)")
   // ),
   //   new HtmlWebpackPlugin(
   //    getHtmlConfig("user-account/certification", "實(shí)名認(rèn)證-我的云商操作臺(tái)")
   //  ),
    new HtmlWebpackPlugin(
      getHtmlConfig("user-message/service", "服務(wù)消息-我的云商操作臺(tái)")
    ),
    new HtmlWebpackPlugin(getHtmlConfig("user-trade/order", "交易訂單-我的云商操作臺(tái)")),
    //   new HtmlWebpackPlugin(getHtmlConfig("user-trade/orderdetail", "訂單詳情")),
    new HtmlWebpackPlugin(getHtmlConfig("user-trade/confirm", "確認(rèn)收貨")),
    new HtmlWebpackPlugin(getHtmlConfig("user-refund/apply", "申請(qǐng)售后")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/index", "購(gòu)物車(chē)")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/confirm-order", "確認(rèn)訂單")),
    new HtmlWebpackPlugin(getHtmlConfig("cart/confirm-order-success", "提交訂單成功"))
  ]
  /* devServer: {
    contentBase: __dirname + "/dist/view", // 當(dāng)前服務(wù)器監(jiān)聽(tīng)的路徑
    hot: true, // 熱更新
    port: 8088, // 定義端口號(hào)
    host: "localhost",
    open: true // 是否自動(dòng)打開(kāi)瀏覽器
  }*/
};

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

module.exports = config;
回答
編輯回答
命多硬

查看 linux 下的npm 和 node版本,升級(jí)到最新版本。
刪除 node_modules 文件夾,重新安裝。

2017年9月13日 20:29