TS error: Cannot find namespace 'Truffle'
Closed this issue · 1 comments
I'm getting the following error when deploying the contracts with yarn migrate
to a local network with ganache:
yarn run v1.22.4
$ truffle migrate --network development --reset
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_main.js
=========
/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/dist/index.js:175
throw error;
^
TSError: ⨯ Unable to compile TypeScript:
migrations/src/1_initial_migration.ts:9:20 - error TS2503: Cannot find namespace 'Truffle'.
9 artifacts: Truffle.Artifacts;
~~~~~~~
migrations/src/1_initial_migration.ts:2:22 - error TS6053: File '/home/gus/Projects/mstable/mStable-contracts/types/generated/index.d.ts' not found.
2 /// <reference path="../../types/generated/index.d.ts" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
migrations/src/1_initial_migration.ts:3:22 - error TS6053: File '/home/gus/Projects/mstable/mStable-contracts/types/generated/types.d.ts' not found.
3 /// <reference path="../../types/generated/types.d.ts" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at createTSError (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:245:12)
at reportTSError (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:249:19)
at getOutput (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:357:34)
at Object.compile (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:415:32)
at Module.m._compile (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:493:43)
at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Object.require.extensions.<computed> [as .ts] (/home/gus/Projects/mstable/mStable-contracts/node_modules/ts-node/src/index.ts:496:12)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at require (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/require/require.js:54:1)
at /home/gus/Projects/mstable/mStable-contracts/migrations/1_main.js:4:26
at Script.runInContext (vm.js:131:20)
at Script.runInNewContext (vm.js:137:17)
at Object.file (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/require/require.js:92:1)
at Migration._load (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/migration.js:43:1)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration.run (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/migration.js:167:1)
at Object.runMigrations (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:148:1)
at Object.runFrom (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:253:1)
at /home/gus/Projects/mstable/mStable-contracts/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:218:1
Truffle v5.1.22 (core: 5.1.22)
Node v12.18.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm executing the instructions presented on Readme
, and wasn't able to find any truffle
or typescript
issues regarding it not finding the namespace. Also, the types generated in the initial migration
are not found, am I missing something?
Thanks in advance
Hi @gusjasponde - I just updated the README to solve your issue.
You should run yarn test-prep
to generate the contract typings first.
I noticed you are working on the gitcoin bounty. You should probably just use the .env.mainnet
file present in the app, instead of getting everything set up locally (see https://github.com/mstable/mStable-app/blob/master/.env.example.mainnet)
Let me know if this causes any more trouble.