% sudo node sign.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './DummyTest.json'
Require stack:
- /Users/name/Downloads/localTest/sign.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/name/Downloads/localTest/sign.js:4:23)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/name/Downloads/localTest/sign.js' ]
}
Node.js v17.3.0
이 오류를 해결하기 위한 방법을 아는데 힘들었다.
https://github.com/nodejs/node/issues/41017
여기서 해결법을 알았다.
문제는 불러오는 파일의 경료가 틀렸기 때문이다.
내 경우는 ./file_name이 아니라 ./build/contract/file_name이었다.