3

I have build my program using the 'anchor build' and also deployed using 'anchor deploy'. But running the 'anchor test' command gives me the error.

Error: target/idl/web_3_meet_program.json doesn't exist. Did you run `anchor build`?
at Object.get (/home/ahmed/development/web3-meet/node_modules/@coral-xyz/anchor/src/workspace.ts:64:15)
at Suite.<anonymous> (/home/ahmed/development/web3-meet/tests/web3-meet.ts:10:36)
at Object.create (/home/ahmed/development/web3-meet/node_modules/mocha/lib/interfaces/common.js:148:19)
at context.describe.context.context (/home/ahmed/development/web3-meet/node_modules/mocha/lib/interfaces/bdd.js:42:27)
at Object.<anonymous> (/home/ahmed/development/web3-meet/tests/web3-meet.ts:5:1)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module.m._compile (/home/ahmed/development/web3-meet/node_modules/ts-mocha/node_modules/ts-node/src/index.ts:439:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Object.require.extensions.<computed> [as .ts] (/home/ahmed/development/web3-meet/node_modules/ts-mocha/node_modules/ts-node/src/index.ts:442:12)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
at Module.require (node:internal/modules/cjs/loader:1230:19)
at require (node:internal/modules/helpers:179:18)
at Object.exports.requireOrImport (/home/ahmed/development/web3-meet/node_modules/mocha/lib/nodejs/esm-utils.js:60:20)
at Object.exports.loadFilesAsync (/home/ahmed/development/web3-meet/node_modules/mocha/lib/nodejs/esm-utils.js:103:20)
at singleRun (/home/ahmed/development/web3-meet/node_modules/mocha/lib/cli/run-helpers.js:125:3)
at Object.exports.handler (/home/ahmed/development/web3-meet/node_modules/mocha/lib/cli/run.js:374:5)

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: No such file or directory (os error 2) This showing the idl folder and also the type folder which contains my .json files

1 Answer 1

3

Im just guessing here, but if you use anchor 0.30.1 you would need to add the build idl feature:

[features]
idl-build = ["anchor-lang/idl-build"]

into your Cargo.toml.

If it is still not creating the idl you may have a compiler error in your program.

You can read about build-idl feature here: https://www.anchor-lang.com/release-notes/0.30.0#idl-build-feature

2
  • Should I need to paste this inside program cargo.toml file or ouside in the root ? Commented Jul 25 at 12:35
  • 1
    cargo.toml under the program folder
    – Jonas H.
    Commented Jul 25 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.