개발일지/오류문제해결

node:internal/modules/cjs/loader:936

자코린이 2021. 12. 24. 00:23

 

% 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

 

Ошибка: node:internal/modules/cjs/loader:936 throw err; · Issue #41017 · nodejs/node

Version node-v17.1.0-win-x64 Platform windows 10 Subsystem No response What steps will reproduce the bug? node index.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module &...

github.com

여기서 해결법을 알았다.

문제는 불러오는 파일의 경료가 틀렸기 때문이다.

내 경우는 ./file_name이 아니라 ./build/contract/file_name이었다.