![](/img/trans.png)
[英]Typescript Nodejs Dockerfile: error TS5057: Cannot find a tsconfig.json file at the specified directory: '.'
[英]`anchor test` error: Failed to run test: yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts: No such file or directory (os error 2)
我刚刚用anchor init
初始化了一个 solana dapp。 然后我使用anchor build
成功构建。 我也尝试测试anchor test
命令,但它失败了,我还没有添加任何代码。 这仍然是未修改的初始化代码,这是错误消息:
Failed to run test: yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts: No such file or directory (os error 2)
它说tests
目录中没有文件但是有mydapp.ts
和这段代码
import * as anchor from "@project-serum/anchor";
import { Program } from "@project-serum/anchor";
import { Mydapp } from "../target/types/mycalculatordapp";
describe("mydapp", () => {
// Configure the client to use the local cluster.
anchor.setProvider(anchor.Provider.env());
const program = anchor.workspace.Mydapp as Program<Mydapp>;
it("Is initialized!", async () => {
// Add your test here.
const tx = await program.rpc.initialize({});
console.log("Your transaction signature", tx);
});
});
我必须在全球范围内安装纱线,因为我的系统上没有它
sudo npm i -g yarn
然后我得到了ts-mocha
command not found 即使它在package.json
上。 所以我运行npm install
来安装所有依赖项。 然后我得到了ts node
错误
sudo npm i -g ts-node
终于成功了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.