Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error is reported when you open Apps #456

Open
D6397 opened this issue Dec 2, 2024 · 18 comments
Open

An error is reported when you open Apps #456

D6397 opened this issue Dec 2, 2024 · 18 comments

Comments

@D6397
Copy link

D6397 commented Dec 2, 2024

An error is reported when you open Apps

srcbook@0.0.15 running at http://localhost:2150
file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:4462
return { error: new GitError(void 0, error.toString("utf-8")) };
^

GitError: HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

at Object.action (file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:4462:25)
at PluginStore.exec (file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:4501:25)
at file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:1369:43
at new Promise (<anonymous>)
at GitExecutorChain.handleTaskData (file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:1367:16)
at GitExecutorChain.<anonymous> (file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:1351:44)
at Generator.next (<anonymous>)
at fulfilled (file:///root/.npm/_npx/f3cf20110f0917c8/node_modules/simple-git/dist/esm/index.js:45:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

task: {
commands: [ 'rev-parse', 'HEAD' ],
format: 'utf-8',
parser: [Function: parser]
}
}

Node.js v20.16.0

image

@D6397 D6397 changed the title An error is reported when you open Apps An error is reported when you open Apps #297 Dec 2, 2024
@D6397 D6397 changed the title An error is reported when you open Apps #297 An error is reported when you open Apps Dec 2, 2024
@glassBead-tc
Copy link
Contributor

@D6397 are you running on Windows?

@D6397
Copy link
Author

D6397 commented Dec 4, 2024

6666
Run Visual Studio Code on Windows to access the ubantu server running

@D6397
Copy link
Author

D6397 commented Dec 4, 2024

The launch command is launched in a terminal on Visual Studio

@D6397
Copy link
Author

D6397 commented Dec 4, 2024

9999
The same is true for the installation of the ubantu system in the container

@niccolox
Copy link

niccolox commented Jan 6, 2025

I am getting this error on Ubuntu 24 full install on Dell XPS laptop (not Windows Ubuntu WSL)

@niccolox
Copy link

niccolox commented Jan 6, 2025

am using docker compose

niccolox@devekko:~/Projects/srcbook$ docker compose up
WARN[0000] /home/niccolox/Projects/srcbook/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 1/0
 ✔ Container srcbook-srcbook-1  Created                                                                                                   0.0s 
Attaching to srcbook-1
srcbook-1  | 
srcbook-1  | > srcbook-monorepo@0.0.1 start /app
srcbook-1  | > turbo start
srcbook-1  | 
srcbook-1  | turbo 2.1.1
srcbook-1  | 
srcbook-1  | • Packages in scope: @srcbook/api, @srcbook/components, @srcbook/configs, @srcbook/shared, @srcbook/web, srcbook
srcbook-1  | • Running start in 6 packages
srcbook-1  | • Remote caching disabled
srcbook-1  | @srcbook/shared:build: cache hit, replaying logs f1d7add7165931e8
srcbook-1  | @srcbook/shared:build: 
srcbook-1  | @srcbook/shared:build: > @srcbook/shared@0.0.13 prebuild /app/packages/shared
  Srcbook  
srcbook-1  | srcbook:start: Serving static files (React app)...
srcbook-1  | srcbook:start: Creating WebSocket server...
srcbook-1  | srcbook:start: Initialization complete
srcbook-1  | srcbook:start: srcbook@0.0.16 running at http://localhost:2150
srcbook-1  | srcbook:start: file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4462
srcbook-1  | srcbook:start:         return { error: new GitError(void 0, error.toString("utf-8")) };
srcbook-1  | srcbook:start:                         ^
srcbook-1  | srcbook:start: 
srcbook-1  | srcbook:start: GitError: Error: spawn git ENOENT
srcbook-1  | srcbook:start:     at ChildProcess._handle.onexit (node:internal/child_process:286:19)
srcbook-1  | srcbook:start:     at onErrorNT (node:internal/child_process:484:16)
srcbook-1  | srcbook:start:     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
srcbook-1  | srcbook:start:     at Object.action (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4462:25)
srcbook-1  | srcbook:start:     at PluginStore.exec (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4501:25)
srcbook-1  | srcbook:start:     at file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1369:43
srcbook-1  | srcbook:start:     at new Promise (<anonymous>)
srcbook-1  | srcbook:start:     at GitExecutorChain.handleTaskData (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1367:16)
srcbook-1  | srcbook:start:     at GitExecutorChain.<anonymous> (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1351:44)
srcbook-1  | srcbook:start:     at Generator.next (<anonymous>)
srcbook-1  | srcbook:start:     at fulfilled (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:45:24) {
srcbook-1  | srcbook:start:   task: {
srcbook-1  | srcbook:start:     commands: [ 'rev-parse', '--is-inside-work-tree' ],
srcbook-1  | srcbook:start:     format: 'utf-8',
srcbook-1  | srcbook:start:     onError: [Function: onError],
srcbook-1  | srcbook:start:     parser: [Function: parser]
srcbook-1  | srcbook:start:   }
srcbook-1  | srcbook:start: }
srcbook-1  | srcbook:start: 
srcbook-1  | srcbook:start: Node.js v22.7.0
srcbook-1  | srcbook:start:  ELIFECYCLE  Command failed with exit code 1.
srcbook-1  | srcbook:start: ERROR: command finished with error: command (/app/srcbook) /usr/local/bin/pnpm run start exited (1)
srcbook-1  | srcbook#start: command (/app/srcbook) /usr/local/bin/pnpm run start exited (1)
srcbook-1  | 
srcbook-1  |  Tasks:    3 successful, 4 total
srcbook-1  | Cached:    3 cached, 4 total
srcbook-1  |   Time:    8.107s 
srcbook-1  | Failed:    srcbook#start
srcbook-1  | 
srcbook-1  |  ERROR  run failed: command  exited (1)
srcbook-1  |  ELIFECYCLE  Command failed with exit code 1.
srcbook-1 exited with code 1

@niccolox
Copy link

niccolox commented Jan 6, 2025

I am totally new to this app, but the first place I will look is on Macbook and see if its OK there

debuggging ideas;

  1. Docker volume issues
  2. simple-git differences between operating systems

@niccolox
Copy link

niccolox commented Jan 6, 2025

similar error on Macbook Docker Desktop docker compose up workflow

note, am using defaults OpenAI which is built into app UX but I see your docs have Anthropic

srcbook-1  | srcbook:start: Serving static files (React app)...
srcbook-1  | srcbook:start: Creating WebSocket server...
srcbook-1  | srcbook:start: Initialization complete
srcbook-1  | srcbook:start: srcbook@0.0.16 running at http://localhost:2150
srcbook-1  | srcbook:start: GitError: Error: spawn git ENOENT
srcbook-1  | srcbook:start:     at ChildProcess._handle.onexit (node:internal/child_process:286:19)
srcbook-1  | srcbook:start:     at onErrorNT (node:internal/child_process:484:16)
srcbook-1  | srcbook:start:     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
srcbook-1  | srcbook:start:     at Object.action (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4462:25)
srcbook-1  | srcbook:start:     at PluginStore.exec (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4501:25)
srcbook-1  | srcbook:start:     at file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1369:43
srcbook-1  | srcbook:start:     at new Promise (<anonymous>)
srcbook-1  | srcbook:start:     at GitExecutorChain.handleTaskData (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1367:16)
srcbook-1  | srcbook:start:     at GitExecutorChain.<anonymous> (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1351:44)
srcbook-1  | srcbook:start:     at Generator.next (<anonymous>)
srcbook-1  | srcbook:start:     at fulfilled (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:45:24) {
srcbook-1  | srcbook:start:   task: { commands: [ 'init' ], format: 'utf-8', parser: [Function: parser] }
srcbook-1  | srcbook:start: }

@niccolox
Copy link

niccolox commented Jan 6, 2025

on ubuntu 'npx srcbook@latest start' works, I assume its related to how srcbook creates the app is in ~/.srcbook/apps when running in node, but when in docker compose or vscode remote server mode it cant handle it as of yet. I havent dug into the code, but I expect having OS switches for folder locations of apps ...

 npx srcbook@latest start

@niccolox
Copy link

niccolox commented Jan 6, 2025

depends on os.homedir() on VS code remote server or Ubuntu docker compose etc.

Annoying long tail implementation details.

export const HOME_DIR = os.homedir();

export const HOME_DIR = os.homedir();
export const SRCBOOKS_DIR = path.join(SRCBOOK_DIR, 'srcbooks');
export const APPS_DIR = path.join(SRCBOOK_DIR, 'apps');

@niccolox
Copy link

niccolox commented Jan 6, 2025

actually, in docker compose app is created, but the utf-8 simple-git error crashes srcbook when clicked in UI

/app # ls -alh /root/.srcbook/apps/hfrf85p651ogp90kiccobugp94/
total 133K   
drwxrwxr-x    5 node     node          13 Jan  6 20:02 .
drwxrwxr-x    3 node     node           3 Jan  6 20:01 ..
drwxrwxr-x    8 node     node          13 Jan  6 20:01 .git
-rw-rw-r--    1 node     node          60 Jan  6 20:01 .npmignore
-rw-rw-r--    1 node     node         274 Jan  6 20:01 index.html
drwxrwxr-x  135 node     node         136 Jan  6 20:02 node_modules
-rw-rw-r--    1 node     node      101.6K Jan  6 20:02 package-lock.json
-rw-rw-r--    1 node     node         613 Jan  6 20:01 package.json
-rw-rw-r--    1 node     node          80 Jan  6 20:01 postcss.config.js
drwxrwxr-x    4 node     node           8 Jan  6 20:02 src
-rw-rw-r--    1 node     node         182 Jan  6 20:01 tailwind.config.js
-rw-rw-r--    1 node     node         552 Jan  6 20:01 tsconfig.json
-rw-rw-r--    1 node     node         166 Jan  6 20:01 vite.config.ts

@niccolox
Copy link

niccolox commented Jan 6, 2025

running in dev it looks like the app is created in .srcbook/apps/... simple-git crashes? on local in dev I guess it restarts, and the app can be viewed in UI, in docker compose the app crashes and doesnt recover?

"dev": "turbo dev",

@niccolox
Copy link

niccolox commented Jan 6, 2025

I just ran "Create a recipe finder app with beautiful food photography, ingredient lists, and step-by-step instructions. Include search and filtering by cuisine type and dietary restrictions." and it generated an app no crash, no issues afaik

there is some difference in the handling of the returned code?

@niccolox
Copy link

niccolox commented Jan 6, 2025

docker workflow also fails, permissions are assigned to root from docker generated apps

prompt

Create a recipe finder app with beautiful food photography, ingredient lists, and step-by-step instructions. Include search and filtering by cuisine type and dietary restrictions.
niccolox@devekko:~/.srcbook/apps$ ls -alh
total 170K
drwxrwxr-x 10 niccolox niccolox 10 Jan  6 14:15 .
drwxrwxr-x  4 niccolox niccolox  5 Jan  6 14:15 ..
drwxr-xr-x  3 root     root     10 Jan  6 14:07 33tu8dm1mf32ce39tnmnb84gt8
drwxrwxr-x  5 niccolox niccolox 13 Jan  6 13:49 93nrcaaks9trh1uj7r6sk57tg0
drwxrwxr-x  5 niccolox niccolox 13 Jan  6 14:13 ap64bhibqvcgmpdjruf554chck
drwxrwxr-x  5 niccolox niccolox 13 Jan  6 14:14 hdmldoeo0b9k4kol2v0h3gte14
drwxrwxr-x  5 niccolox niccolox 13 Jan  6 13:37 hfrf85p651ogp90kiccobugp94
drwxr-xr-x  3 root     root     10 Jan  6 14:15 k6c7onuai825qdb3jf1gq9hdtc
drwxr-xr-x  3 root     root     10 Jan  6 14:00 l37o43leqdcqjosst0rr0socpg
drwxrwxr-x  5 niccolox niccolox 13 Jan  6 13:57 tg1eufkfajpibvpk0shnp25db4

@niccolox
Copy link

niccolox commented Jan 6, 2025

pretty sure there is an issue with the docker container running as root? I just tried to remove the host volume and persist the app created inside the container but I still get the error and it looks like I crash the container

Create a recipe finder app with beautiful food photography, ingredient lists, and step-by-step instructions. Include search and filtering by cuisine type and dietary restrictions.
docker run -p 2150:2150 -v ~/.npm:/root/.npm srcbook
srcbook:start: Serving static files (React app)...
srcbook:start: Creating WebSocket server...
srcbook:start: Initialization complete
srcbook:start: srcbook@0.0.16 running at http://localhost:2150
srcbook:start: GitError: Error: spawn git ENOENT
srcbook:start:     at ChildProcess._handle.onexit (node:internal/child_process:286:19)
srcbook:start:     at onErrorNT (node:internal/child_process:484:16)
srcbook:start:     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
srcbook:start:     at Object.action (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4462:25)
srcbook:start:     at PluginStore.exec (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:4501:25)
srcbook:start:     at file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1369:43
srcbook:start:     at new Promise (<anonymous>)
srcbook:start:     at GitExecutorChain.handleTaskData (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1367:16)
srcbook:start:     at GitExecutorChain.<anonymous> (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:1351:44)
srcbook:start:     at Generator.next (<anonymous>)
srcbook:start:     at fulfilled (file:///app/node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js:45:24) {
srcbook:start:   task: { commands: [ 'init' ], format: 'utf-8', parser: [Function: parser] }
srcbook:start: }

@niccolox
Copy link

niccolox commented Jan 6, 2025

ok, folder owned by root but files owned by user when using docker

would need to try to find a way to log or setup checkpoints

I just kind of crashed through the app via debugging

ls -alh tg1eufkfajpibvpk0shnp25db4
total 133K
drwxrwxr-x   5 niccolox niccolox   13 Jan  6 13:57 .
drwxrwxr-x  12 niccolox niccolox   12 Jan  6 14:34 ..
drwxrwxr-x   8 niccolox niccolox   13 Jan  6 13:56 .git
-rw-rw-r--   1 niccolox niccolox   60 Jan  6 13:56 .gitignore
-rw-rw-r--   1 niccolox niccolox  274 Jan  6 13:56 index.html
drwxrwxr-x 135 niccolox niccolox  136 Jan  6 13:57 node_modules
-rw-rw-r--   1 niccolox niccolox  613 Jan  6 13:56 package.json
-rw-rw-r--   1 niccolox niccolox 102K Jan  6 13:57 package-lock.json
-rw-rw-r--   1 niccolox niccolox   80 Jan  6 13:56 postcss.config.js
drwxrwxr-x   4 niccolox niccolox    8 Jan  6 13:57 src
-rw-rw-r--   1 niccolox niccolox  182 Jan  6 13:56 tailwind.config.js
-rw-rw-r--   1 niccolox niccolox  552 Jan  6 13:56 tsconfig.json
-rw-rw-r--   1 niccolox niccolox  166 Jan  6 13:56 vite.config.ts

I am not sure I am getting consistent results, could the API be returning inconsistently?

stepping away

@niccolox
Copy link

niccolox commented Jan 7, 2025

git difference between app created by docker; owner of files is root, no git history. no initial commit

niccolox@devekko:~/.srcbook/apps/l37o43leqdcqjosst0rr0socpg$ ls -alh
total 62K
drwxr-xr-x  3 root     root      10 Jan  6 14:00 .
drwxrwxr-x 12 niccolox niccolox  12 Jan  6 14:34 ..
-rw-r--r--  1 root     root      60 Jan  6 14:00 .gitignore
-rw-r--r--  1 root     root     274 Jan  6 14:00 index.html
-rw-r--r--  1 root     root     613 Jan  6 14:00 package.json
-rw-r--r--  1 root     root      80 Jan  6 14:00 postcss.config.js
drwxr-xr-x  2 root     root       6 Jan  6 14:00 src
-rw-r--r--  1 root     root     182 Jan  6 14:00 tailwind.config.js
-rw-r--r--  1 root     root     552 Jan  6 14:00 tsconfig.json
-rw-r--r--  1 root     root     166 Jan  6 14:00 vite.config.ts
niccolox@devekko:~/.srcbook/apps/l37o43leqdcqjosst0rr0socpg$ git status
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

vs dev run version where ownership seems sensible and git history

niccolox@devekko:~/.srcbook/apps/93nrcaaks9trh1uj7r6sk57tg0$ git log
commit c37421dc259ea8a1acbc5bad3c2be8d12c4d3f25 (HEAD -> master)
Author: Srcbook <ai@srcbook.com>
Date:   Mon Jan 6 13:48:56 2025 -0800

    Initial commit
niccolox@devekko:~/.srcbook/apps/93nrcaaks9trh1uj7r6sk57tg0$ ls -alh
total 133K
drwxrwxr-x   5 niccolox niccolox   13 Jan  6 13:49 .
drwxrwxr-x  12 niccolox niccolox   12 Jan  6 14:34 ..
drwxrwxr-x   8 niccolox niccolox   13 Jan  6 16:58 .git
-rw-rw-r--   1 niccolox niccolox   60 Jan  6 13:48 .gitignore
-rw-rw-r--   1 niccolox niccolox  283 Jan  6 13:48 index.html
drwxrwxr-x 135 niccolox niccolox  136 Jan  6 13:49 node_modules
-rw-rw-r--   1 niccolox niccolox  622 Jan  6 13:48 package.json
-rw-rw-r--   1 niccolox niccolox 102K Jan  6 13:49 package-lock.json
-rw-rw-r--   1 niccolox niccolox   80 Jan  6 13:48 postcss.config.js
drwxrwxr-x   3 niccolox niccolox    7 Jan  6 13:49 src
-rw-rw-r--   1 niccolox niccolox  182 Jan  6 13:48 tailwind.config.js
-rw-rw-r--   1 niccolox niccolox  552 Jan  6 13:48 tsconfig.json
-rw-rw-r--   1 niccolox niccolox  166 Jan  6 13:48 vite.config.ts

@niccolox
Copy link

niccolox commented Jan 7, 2025

doing more investigations, totally feels like the Docker container creating files as root into host volume issue, which is frankly a huge pita regards Windows, Linux, Mac

I am getting same or similar errors on GIT stage of lifecycle of app on Mac and Linux right now. My first day poking around. Maybe Docker Compose watch is a way out. Maybe there is an elegant solution in some other tooling.

This was referenced Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants