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

https://medium.com/@su_bak/cannot-find-module-fs-promises-%E1%84%8B%E1%85%A6%E1%84%85%E1%85%A5-%E1%84%92%E1%85%A2%E1%84%80%E1%85%A7%E1%86%AF-%E1%84%87%E1%85%A1%E1%86%BC%E1%84%87%E1%85%A5%E1%86%B8-a344921bd430

 

 
 
 
 
반응형

+ Recent posts