nextjs无法在服务器上构建

时间:2018-08-10 22:17:21

标签: reactjs next.js

当我为nextjs运行npm run build时,它确实在Windows中构建,但不能在Linux服务器上构建。问题在于构建过程无法解析组件的相对路径。

import React, { Component } from "react";
import { connect } from "react-redux";
import Layout from "components/Layout";
import WithAuth from "components/WithAuth";
import Head from "next/head";

class Profile extends Component {
  render() {
    return (
      <React.Fragment>
        <Head>
          <title>TripeMa</title>
          <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0"
          />
          <link
            rel="shortcut icon"
            type="image/x-icon"
            href="/static/images/tripe-ma-app-icon-rec.ico"
          />
          <meta charSet="UTF-8" />
          <meta name="theme-color" content="#d0f4f0" />
        </Head>
        <Layout Component={WithAuth} />
      </React.Fragment>
    );
  }
}

export default connect()(Profile);
  
    

1.0.0构建/ home / user / site     下一个版本

  
     

使用外部babel配置   位置:“ / home / user / site / .babelrc.js”   建立失败   {错误:(客户端)。/pages / profile.js   找不到模块:错误:无法解析“ / home / useri / site / pages”中的“ ../components/WithAuth”    @ ./pages/profile.js 20:0-46

0 个答案:

没有答案