안녕하세요
[GCP] babel-node doesn't work with type: module. 본문
[GCP] babel-node doesn't work with type: module.
sakuraop 2023. 2. 21. 16:56https://github.com/babel/babel/issues/11108
type: module을 사용할 경우 type: module 사용은 호환이 되지 않는다.
https://yamoo9.gitbook.io/webpack/babel/babel-node
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2023-02-21T08:33:11.345Z61.fc.1:
> backend@1.0.0 start /app
> node server.js
(node:18) ExperimentalWarning: The ESM module loader is experimental.
file:///app/node_modules/axios/lib/adapters/http.js:7
import {getProxyForUrl} from 'proxy-from-env';
^^^^^^^^^^^^^^
SyntaxError: The requested module 'proxy-from-env' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'proxy-from-env';
const {getProxyForUrl} = pkg;
type:module 은 GCP와 호환이 안되는 것 같습니다.
es6 모듈시스템 쓰지 말고, 그냥 commonJS로 작성하도록 해야겠습니다.
When you are using {"type":"module"} in your project, you may use transcompiler like "Babel" to make your project compatible with GCP.
I couldn't successfully deploy with babel-node as in the above URL.
I recommend you to use "CommonJS" in your project to ensure compatibility with the GCP environment.
'유튜브컨텐츠탐색-StelLife > Google App Engine' 카테고리의 다른 글
GCP 배포 Uncaught SyntaxError: Unexpected token '<' 에러 해결 방법들 (0) | 2023.08.05 |
---|---|
GCP cron: 특정 api로 요청 보내 작업 예약실행하기 (0) | 2023.03.27 |
프로젝트(6) - 구글 클라우드 플랫폼 서버 배포, gcp error (3) | 2023.02.10 |