inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

리액트로 구현하는 블록체인 이더리움 Dapp

배포(2)

hello.say() is not a function

350

MINSEONG HEO

작성한 질문수 2

2

배포2 단원에서 truffle console --network development 후

truffle(development)> var hello = HelloWorld.at("0x9876ff5b2729D2800f87852F7be329D32B35c244")
undefined
truffle(development)> hello.say()
Thrown:
evalmachine.:0
hello.say()
^

TypeError: hello.say is not a function
at evalmachine.:0:7
at Script.runInContext (vm.js:135:20)
at runScript (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibconsole.js:199:1)
at Console.interpret (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibconsole.js:213:1)
at ReplManager.interpret (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibrepl.js:118:1)
at bound (domain.js:425:14)
at REPLServer.runBound [as eval] (domain.js:438:12)
at REPLServer.onLine (repl.js:650:10)
at REPLServer.emit (events.js:197:13)
at REPLServer.EventEmitter.emit (domain.js:481:20)
이렇게 에러가 뜨는데 어떻게 해결해야 하나요?

react dapp Ethereum truffle

답변 3

3

Spielmann Kim김신종

버전이 달라서 저는 지금 마이그레이트를 하면 프롬프트에 이렇게 떠서 HelloWorld를 디플로이 했을 시 생긴 컨트랙트주소 부분을 사용해야 언디파인드가 되고 hello.say()를 했을 시 문자열이 잘나타났습니다! 혹시 저와 같은 버전으로 하고 계신분들 참고해주세요!

Compiling your contracts...

===========================

> Everything is up to date, there is nothing to compile.

Starting migrations...

======================

> Network name:    'development'     

> Network id:      5777

> Block gas limit: 6721975 (0x6691b7)

1_initial_migration.js

======================

   Deploying 'Migrations'

   ----------------------

   > transaction hash:    0xa83a42953525bba41c94b902b3bcfa09dc90fcf3a18a77f66b52b797cefc7758

   > Blocks: 0            Seconds: 0

   > contract address:    0x5B6c3496D20404A3e0755487B2d809D7174E2cC9

   > block number:        1

   > block timestamp:     1614761582

   > account:             0xFfc1DC506c8D47144DBA97435b102FaE4c5BD39b

   > balance:             99.99616114

   > gas used:            191943 (0x2edc7)

   > gas price:           20 gwei

   > value sent:          0 ETH

   > total cost:          0.00383886 ETH

   > Saving migration to chain.

   > Saving artifacts

   -------------------------------------

   > Total cost:          0.00383886 ETH

2_hello_deploy.js

=================

   Deploying 'HelloWorld'

   ----------------------

   > transaction hash:    0xe3769cf3541753b8ad4a76c5a52da9926368a39cd5c1e7a9cf9a72dfc1a162c4

   > Blocks: 0            Seconds: 0

   > contract address:    0xe5A71c2b65D2BB74D25121EBfd73C979854F086e

   > block number:        3

   > block timestamp:     1614761583

   > account:             0xFfc1DC506c8D47144DBA97435b102FaE4c5BD39b

   > balance:             99.989001

   > gas used:            315669 (0x4d115)

   > gas price:           20 gwei

   > value sent:          0 ETH

   > total cost:          0.00631338 ETH

   > Saving migration to chain.

   > Saving artifacts

   -------------------------------------

   > Total cost:          0.00631338 ETH

Summary

=======

> Total deployments:   2

> Final cost:          0.01015224 ETH

1

coldmind

먼저 트러플 버전을 확인하고

truffle version

5.x대의 버전이라면 Contract.at 사용시 다음과 같이 await를 앞에 써주어야 합니다.

var hello = await HelloWorld.at("0x9876ff5b2729D2800f87852F7be329D32B35c244")

트러플 버전 4.x에서는 await를 붙이지 마시고요.

0

MINSEONG HEO

감사합니다 덕분에 해결 되었습니다.

VSCODE Extension Claude와 터미널 차이

0

5

0

claude-nextjs-starterkit에서 .claude폴더 생성

0

6

1

Claude Code 자동 Update 활성화 방법은?

0

8

0

Vercel 배포 과정에서 오류가 발생합니다

0

15

1

리프레시토큰

0

23

1

/memory를 쓸 필요가 있나요? 그냥 md 들어가서 편집하면 안되나용?

0

55

2

로그인 확인

0

64

3

서브에이전트 생성시 레퍼런스 및 스킬 생성

0

55

2

Git, Github 기초부터 실전까지 중 질문드립니다.

0

75

3

재생이 안됩니다.

0

55

1

클로드 설치 및 강의 미션 관련

0

61

1

/config Thinking mode 설정

0

55

2

안녕하세요, 강의 수강 중인 학생입니다.

0

51

2

rules 폴더나 CLAUDE.md 파일 관리 관련 질문

0

50

2

cursor 안에서 다운로드 안되는 게 많은데 대체가 필요할까요

0

66

2

truffle migrate --network development 입력했더니

1

573

1

truffle init을 하면 truffle.js파일이 만들어지지 않습니다.

1

401

2

파워쉘에서는 truffle unbox react가 안됩니다 ㅠㅠ

1

583

5

플립함수 구현관련 심화 문의드립니다.

1

340

2

리액트 상자에 트러플 의존성이 없습니다.

1

281

1

Mac 개발 환경 세팅 관련 문의

0

279

1

슬랙에 초대해주세요

0

255

1

현 시점에서 HelloWorld.sol 컴파일이 실행되지 않습니다.

0

377

2

deploy에러입니다

0

238

1