inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Slack 클론 코딩[실시간 채팅 with React]

이미지 드래그 업로드하기

[배포하기] webpack에 aws 퍼블릭 IPv4 주소 와 포트 주소를 작성하고 나서 빌드후 실행하면 오류가 발생합니다.

332

박동규

작성한 질문수 4

0

[배포하기]를 수강 이후에 개발한 프로젝트를

aws에 배포하는 중에서 문제가 발생하여 질문 드려요

  devServer: {
    historyApiFallback: true,
    host: '퍼블릭 IPv4 주소',
    port: 3333,
    devMiddleware: { publicPath: '/dist/' },
    static: { directory: path.resolve(__dirname) },
  },

host에 퍼블릭 IPv4 주소 을 설정하고 aws에 port 3333 포트를 열어 주었습니다.

  "scripts": {
    "dev": "webpack serve --env development",
    "build": "webpack",
    "start": "webpack serve"
  },

npm run build 이후에

npm run start 할 경우

(퍼블릭 IPv4 주소 -> ex: 11.111.111.11

 

Error: listen EADDRNOTAVAIL: address not available 11.111.111.11:3333

    at Server.setupListenHandle [as _listen2] (net.js:1314:21)

    at listenInCluster (net.js:1379:12)

    at doListen (net.js:1516:7)

    at processTicksAndRejections (internal/process/task_queues.js:83:21) {

  code: 'EADDRNOTAVAIL',

  errno: -99,

  syscall: 'listen',

  address: '11.111.111.11',

  port: 3333

}

오류가 발생했습니다. 무엇이 문제인지 잘 모르겠어서 질문드립니다.

 

 

[aws 실행상태]

aws_인스턴스 한개에 back,front 폴더를 git을 사용 하여 백,프론트를 실행하고 있습니다.

[전체 코드 - webpack.config.js]

const path = require('path');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const webpack = require('webpack');

const isDevelopment = process.env.NODE_ENV !== 'production';

const config = {
  name: 'google_meet',
  mode: isDevelopment ? 'development' : 'production',
  devtool: isDevelopment ? 'hidden-source-map' : 'inline-source-map',
  resolve: {
    extensions: ['.js', '.jsx', '.json'],
    alias: {
      '@hooks': path.resolve(__dirname, 'hooks'),
      '@components': path.resolve(__dirname, 'components'),
      '@layouts': path.resolve(__dirname, 'layouts'),
      '@pages': path.resolve(__dirname, 'pages'),
      '@utils': path.resolve(__dirname, 'utils'),
    },
  },
  entry: {
    app: './client',
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: 'babel-loader',
        options: {
          presets: [
            [
              '@babel/preset-env',
              {
                targets: { browsers: ['last 2 chrome versions'] },
                debug: isDevelopment,
              },
            ],
            '@babel/preset-react',
          ],
          env: {
            development: {
              plugins: [require.resolve('react-refresh/babel')],
            },
          },
        },
        exclude: path.join(__dirname, 'node_modules'),
      },
      {
        test: /\.css?$/,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
  plugins: [new webpack.EnvironmentPlugin({ NODE_ENV: isDevelopment ? 'development' : 'production' })],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: '[name].js',
    publicPath: '/dist/',
  },
  devServer: {
    historyApiFallback: true,
    host: '퍼블릭 IPv4 주소',
    port: 3333,
    devMiddleware: { publicPath: '/dist/' },
    static: { directory: path.resolve(__dirname) },
  },
};

if (isDevelopment && config.plugins) {
  config.plugins.push(new webpack.HotModuleReplacementPlugin());
  config.plugins.push(new ReactRefreshWebpackPlugin());
}
if (!isDevelopment && config.plugins) {
}

module.exports = config;

react 웹팩 typescript socket.io babel 클론코딩

답변 1

0

제로초(조현영)

devServer는 배포후에 사용하지 않아서 바꾸실 이유가 없습니다. 굳이 서버에서 사용하더라도 로컬호스트 그대로 놔두면 됩니다. 그래도 외부에서는 퍼블릭아이피로 접근 가능합니다.

기본 셋팅과 관련하여

0

90

1

초기 셋팅 back과 front만 남겨두고 다 지운 후 진행 방법

0

95

2

focus 시에만 화면 업데이트 되는 이유 + 해결방법

0

148

2

useEffect 개수 관리

0

108

2

라이브러리 서치 방법

0

103

2

함수 정의 패턴

0

77

1

npm run dev 에러

0

151

3

npx webpack 후 에러

0

177

2

'void' 형식 식의 truthiness를 테스트할 수 없습니다.ts(1345)

0

142

2

사용자 가입시 에러발생 (TypeError: Cannot read properties of null (reading 'addMembers')

1

176

2

초기세팅중 packge.json 에러떠요

0

154

2

CORS - Access-Control-Allow-Origin 누락 문제

0

426

3

로그인 페이지 무한 새로고침 현상

0

598

2

Module not found: Error: Can't resolve './App' 에러

0

949

1

배포 방법

0

295

2

npm run dev 시 빌드가 매우 느려졌습니다

0

985

2

alias 경로 설정 오류

0

446

2

fetcher 함수의 data 값이 두번 찍히는 이유

0

273

1

제네릭 질문

0

216

2

ts-node 대신 tsx 사용여부

0

373

1

배포 관련 질문

0

243

1

[nginx + https] 서비스를 실행하면 niginx가 아닌 서비스 화면을 보여주게 하고 싶습니다.

0

382

2

users 호출 시 쿠키가 담기지 않는 이슈 질문드립니다.

0

244

2

CORS 에러 질문입니다.

0

263

1