lgrammel / js-agent

Build AI Agents with JS & TS
MIT License
229 stars 35 forks source link

ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND  #16

Closed matigumma closed 1 year ago

matigumma commented 1 year ago

at mac m1 doing this


// # in root folder:

> pnpm install

// 🐳 start docker daemon ...

> pnpm nx run-many --target=build

> cd examples/javascript-developer

> mkdir drive

> pnpm build
...
 .build/gptagent-executor.js  2.1mb ⚠️
⚡ Done in 124ms
[+] Building 1.1s (13/13) FINISHED                                                                                                 
 => [internal] load build definition from Dockerfile                                                                          0.0s
 => => transferring dockerfile: 37B                                                                                           0.0s
 => [internal] load .dockerignore                                                                                             0.0s
 => => transferring context: 2B                                                                                               0.0s
 => [internal] load metadata for docker.io/library/node:lts-alpine                                                            1.0s
 => [1/8] FROM docker.io/library/node:lts-alpine@sha256:ca5d399560a9d239cbfa28eec00417f1505e5e108f3ec6938d230767eaa81f61      0.0s
 => [internal] load build context                                                                                             0.1s
 => => transferring context: 2.24MB                                                                                           0.0s
 => CACHED [2/8] RUN apk update && apk add dumb-init && apk add git && apk add ca-certificates                                0.0s
 => CACHED [3/8] RUN npm install -g npm@9.6.2                                                                                 0.0s
 => CACHED [4/8] RUN npm install -g pnpm                                                                                      0.0s
 => CACHED [5/8] RUN apk add python3 && apk add build-base                                                                    0.0s
 => CACHED [6/8] WORKDIR /home/service                                                                                        0.0s
 => CACHED [7/8] COPY --chown=node:node .build/gptagent-executor.js /home/service                                             0.0s
 => CACHED [8/8] WORKDIR /home/service/repository                                                                             0.0s
 => exporting to image                                                                                                        0.0s
 => => exporting layers                                                                                                       0.0s
 => => writing image sha256:63e9eac913f6bcedbcdeb23b046108c355461aae652a64d1d05c8232d916bd86                                  0.0s
 => => naming to docker.io/library/gptagent-javascript-developer                                                              0.0s

 javascript-developer > pnpm run-executor

 Run js-agent executor container
Drive: /Users/admin/js-agent/examples/javascript-developer/drive
...
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
{"level":30,"time":1682034345171,"pid":11,"hostname":"b4fe30d7745f","message":"Server listening at http://0.0.0.0:3001"}
... 

// on new terminal : 
javascript-developer > pnpm run-agent `cat example/helloworld/task.txt`
...
> @js-agent/example-javascript-developer@0.0.0 run-agent /Users/admin/js-agent/examples/javascript-developer
> ts-node ./src/main.ts "The" "classical" "introductory" "exercise." "Just" "say" "\"Hello," "World!\"." "\"Hello," "World!\"" "is" "the" "traditional" "first" "program" "for" "beginning" "programming" "in" "a" "new" "language" "or" "environment." "The" "objectives" "are" "simple:" "Write" "a" "program" "that" "prints" "the" "string" "\"Hello," "World!\"." "Write" "the" "program" "in" "JavaScript."

### JavaScript Developer Agent ###
The classical introductory exercise. Just say "Hello, World!". "Hello, World!" is the traditional first program for beginning programming in a new language or environment. The objectives are simple: Write a program that prints the string "Hello, World!". Write the program in JavaScript.

Executing run-command…
## Command pnpm install executed successfully
### stdout
ERR_PNPM_NO_PKG_MANIFEST  No package.json found in /home/service/repository

Executing run-command…
## Command pnpm nx run agent:build executed successfully
### stdout
ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND  No package.json (or package.yaml, or package.json5) was found in "/home/service/repository".

Thinking…
Done

then i go inside docker container

image
lgrammel commented 1 year ago

The error message means that the project in the drive folder is not a pnpm project. The current setup steps in src/main.ts are example steps that are useful when js-agent itself is the project in the drive folder. I'll make them optional and clarify the instructions. Thanks for filing the bug!

matigumma commented 1 year ago

its like a run pnpm init -y must be in the Dockerfile steps?

lgrammel commented 1 year ago

The setup sets are called in each agent run using a fixed steps executor ( https://github.com/lgrammel/js-agent/blob/main/examples/javascript-developer/src/runDeveloperAgent.ts#L32 ).

I've added more documentation around the project setup!