Tech
[netlify] 배포 오류 Cannot find module fs/promises
Honey buns
2022. 6. 6. 15:04
728x90
반응형
netlify 에서 배포 중 아래와 같이 에러가 시작되며 배포가 fail을 반복하고 있었음.
netlify 의 기본 node 버전은 12버전인듯 한데 이때문에 아래와 같은 오류가 시작됨.
Cannot find module ‘fs/promises’
2:43:42 PM: ────────────────────────────────────────────────────────────────
2:43:42 PM: 1. Build command from Netlify app
2:43:42 PM: ────────────────────────────────────────────────────────────────
2:43:42 PM:
2:43:42 PM: $ gatsby build
2:43:45 PM: success open and validate gatsby-configs - 0.078s
2:43:47 PM: error Error in "/opt/build/repo/node_modules/gatsby-plugin-robots-txt/gatsby-node.js": Cannot find module 'fs/promises'
2:43:47 PM: Require stack:
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-plugin-robots-txt/gatsby-node.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/services/initialize.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/services/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/commands/build.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/create-cli.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bin/gatsby.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/cli.js
2:43:47 PM:
2:43:47 PM:
2:43:47 PM: Error: Cannot find module 'fs/promises'
2:43:47 PM: Require stack:
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-plugin-robots-txt/gatsby-node.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/services/initialize.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/services/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/commands/build.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/create-cli.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/index.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/dist/bin/gatsby.js
2:43:47 PM: - /opt/build/repo/node_modules/gatsby/cli.js
해결 : 프로젝트 최상단 경로에 .nvmrc 파일을 생성하고 그 안에 버전 명을 기재한 후에 배포함
참조
https://answers.netlify.com/t/build-error-in-remix-app-with-prisma-seed-file/52594/3
반응형