Hello!
I’m not able to setup an empty nakama project following this testing guide
I googled a lot and tormented a ChatGPT without luck.
My setup is basically an empty starter project with a TS. Nothing fancy just created the project with official guide.
On the command docker compose up --build nakama
it was up and running.
Then I decided to setup a testing environment for a more robust development and already lost about 6 hours. Not very productive I should say. Buy the way, back to the problem.
What I did is just followed a guide up to the import 'jest-ts-auto-mock';
step. And after that I tried to execute docker compose up --build nakama
again and the output looks like this
➜ nakama-a git:(master) ✗ docker compose up --build nakama
[+] Building 111.5s (14/16)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for registry.heroiclabs.com/heroiclabs/nakama:3.15.0 10.6s
=> [internal] load metadata for docker.io/library/node:alpine 4.3s
=> [node-builder 1/8] FROM docker.io/library/node:alpine@sha256:37750e51d61bef92165b2e29a77da4277ba0777258446b7a9c99511f119db096 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 212.43kB 0.2s
=> CACHED [stage-1 1/3] FROM registry.heroiclabs.com/heroiclabs/nakama:3.15.0@sha256:8015dc03045829e4ec28d9f73895b774a33dfba07373bc447ed559e6903fee28 0.0s
=> CACHED [node-builder 2/8] WORKDIR /backend 0.0s
=> CACHED [node-builder 3/8] RUN apk add --no-cache git 0.0s
=> [node-builder 4/8] COPY package*.json . 0.0s
=> [node-builder 5/8] RUN npm install 98.3s
=> [node-builder 6/8] COPY tsconfig.json . 0.0s
=> [node-builder 7/8] COPY src ./src 0.0s
=> ERROR [node-builder 8/8] RUN npx tsc 2.3s
------
> [node-builder 8/8] RUN npx tsc:
#0 2.205 error TS2688: Cannot find type definition file for '@ampproject'.
#0 2.205 The file is in the program because:
#0 2.205 Entry point for implicit type library '@ampproject'
#0 2.205 error TS2688: Cannot find type definition file for '@babel'.
#0 2.205 The file is in the program because:
#0 2.205 Entry point for implicit type library '@babel'
#0 2.207 The file is in the program because:
#0 2.207 Entry point for implicit type library 'y18n'
#0 2.207 error TS2688: Cannot find type definition file for 'yallist'.
... A lot of other similar staff
#0 2.207 The file is in the program because:
#0 2.207 Entry point for implicit type library 'yargs'
#0 2.207 error TS2688: Cannot find type definition file for 'yargs-parser'.
#0 2.207 The file is in the program because:
#0 2.207 Entry point for implicit type library 'yargs-parser'
------
failed to solve: executor failed running [/bin/sh -c npx tsc]: exit code: 2
- Versions: Nakama {3.15}, Mac, Docker, node v20.7.0, npm 10.1.0
- Server Framework Runtime language: TS/JS
Dockerfile
FROM node:alpine AS node-builder
WORKDIR /backend
COPY package*.json .
RUN npm install
RUN ls
COPY tsconfig.json .
RUN mkdir src
COPY src/*.ts ./src
RUN ls
RUN npx tsc
FROM registry.heroiclabs.com/heroiclabs/nakama:3.15.0
COPY --from=node-builder /backend/build/*.js /nakama/data/modules/build/
RUN ls /nakama/data/modules
RUN ls /nakama/data/modules/build/
COPY local.yml ./data
RUN ls
RUN ls /nakama/data/
package.json
{
"name": "nakama-a",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest"
},
"jest": {
"globals": {
"ts-jest": {
"compiler": "ttypescript"
}
},
"transform": {
".(ts|tsx)": "ts-jest"
},
"setupFiles": [
"<rootDir>jest-config.ts"
]
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"nakama-runtime": "github:heroiclabs/nakama-common"
},
"devDependencies": {
"@types/jest": "^29.5.5",
"jest": "^29.7.0",
"jest-ts-auto-mock": "^2.1.0",
"ts-auto-mock": "^3.7.1",
"ts-jest": "^29.1.1",
"ttypescript": "^1.5.15"
}
}
I googled and tried to apply a lot of different solutions for ERROR RUN npx tsc
and error TS2688: Cannot find type definition file for
without success.
Can someone help me with Jest setup, please? When I remove all Jset dependencies and setup Nakama works fine, but I want to have a proper testing environment for a quicker development iteration. Thank you in advance.