code-server icon indicating copy to clipboard operation
code-server copied to clipboard

ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'

Open wwbmmm opened this issue 7 years ago • 71 comments

  • code-server version: v1.31.1-100
  • OS Version: Ubuntu 18.10

Steps to Reproduce

  1. use docker to start code-server, wait a while
  2. and you will see this error:
ERROR SHARED stderr {"data":"Uncaught Exception:  Error: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json'\n    at Timeout.eval [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27336), <anonymous
>:76664:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:
290:5)\n"}

wwbmmm avatar Mar 08 '19 04:03 wwbmmm

@ndom91 I tried creating the Backups folder with an empty workspace.json but now i get this: ERROR SHARED stderr {"data":"Uncaught Exception: Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n at JSON.parse (<anonymous>)\n at pfs_1.readFile.then.contents (eval at exports.requireModule (/home/cj/vscode/code-server/code-server:468:27660), <anonymous>:77277:45)\n at <anonymous>\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/home/cj/vscode/code-server/code-server:468:27660), <anonymous>:52540:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

I guess i need a proper workspaces.json? What version are you using? Does anyone know whats in that file? Even better, does anyone have a default one that they can share?

hexlo avatar Mar 13 '19 01:03 hexlo

After creating a workspaces.json in the desired directory and filling it with the content

{
        "folders": [
                {
                        "path": "/home/<username_redacted>/code-server/workspace/folders"
                }
        ]
}

I get a new error:

ERROR SHARED stderr {"data":"Uncaught Exception:  Error: Cannot read property 'map' of undefined\n\nTypeError: Cannot read property 'map' of undefined\n    at pfs_1.readFile.then.contents (eval at exports.requireModule (/home/<username_redacted>/code-server/code-server-1.32.0-245-linux-x64/code-server:468:27660), <anonymous>:77278:76)\n    at <anonymous>\n    at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/home/<username_redacted>/code-server/code-server-1.32.0-245-linux-x64/code-server:468:27660), <anonymous>:52540:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)\n"}

dansou901 avatar Mar 13 '19 10:03 dansou901

Hmm strange, like I said mine worked while it was empty - as long as it was there. The full command for me was the following:

/opt/vscode-server/code-server /var/www/html -d /home/ndo/.code-server --password=####### --allow-http

ndom91 avatar Mar 14 '19 05:03 ndom91

OK, I never tried with --allow-http, maybe thats different then. I'll try that later and report back...

dansou901 avatar Mar 14 '19 09:03 dansou901

Just tried with --allow-http, same error...

dansou901 avatar Mar 14 '19 10:03 dansou901

Yeah sorry I should have mentioned, I only have allow http because I have it behind a reverse proxy with nginx

ndom91 avatar Mar 14 '19 10:03 ndom91

Windows with Docker Desktop, similar result...

$ docker run --rm -it -p 8443:8443 -v "${PWD}://root//project" codercom/code-server --allow-http --no-auth -d //root//project
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/root/project","working-dir":"/root/project","log-dir":"/root/.cache/code-server/logs/20190314233657085"}
INFO  Starting shared process [1/5]...
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://coder.com/docs
WARN  Launched without authentication.
INFO
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO
INFO  Connected to shared process
ERROR SHARED stderr {"data":"Uncaught Exception:  Error: ENOENT: no such file or directory, open '/root/project/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/project/Backups/workspaces.json'\n    at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:57561:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)\n"}
^CINFO  Starting shared process [1/5]... {"error":"Exited with null"}
INFO  Connected to shared process
ERROR SHARED stderr {"data":"Uncaught Exception:  Error: ENOENT: no such file or directory, open '/root/project/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/project/Backups/workspaces.json'\n    at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:57561:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)\n"}

tracker1 avatar Mar 14 '19 23:03 tracker1

I solved this in Docker on elementaryOS (Linux Desktop)

I tried the following docker-compose setup:

  vscode:
    image: codercom/code-server
    entrypoint: sh -c "mkdir -p /root/.local/share/code-server/Backups/ && touch /root/.local/share/code-server/Backups/workspaces.json && code-server --allow-http"
    expose:
      - 8443
    volumes:
      - /home/henry/development:/root/project
    restart: always
    networks:
      - vscode
    depends_on:
      - nginx-proxy

Notice I just overrode the entrypoint to make the file in question then run code-server

henryfjordan avatar Mar 14 '19 23:03 henryfjordan

  1. use directory A as workspace to mount and start the docker, not error
  2. use directory B as workspace to mount and restart the docker, ENOENT: no such file or directory, open '/root/.code-server/Backups/workspaces.json
  3. switch back to directory A as workspace to mount and restart, no error

Looks like if you use a new workspace directory, it did not correctly create the workspaces.json?

Gary-KK avatar Mar 15 '19 04:03 Gary-KK

Having the same issue when using the default Dockerfile.

ERROR SHARED stderr {"data":"Uncaught Exception: Error: ENOENT: no such file or directory, open '/root/.local/share/code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/root/.local/share/code-server/Backups/workspaces.json'\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:56921:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

If I manually create /root/.local/share/code-server/Backups/workspaces.json, it gives the following error:

ERROR SHARED stderr {"data":"Uncaught Exception: Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n at JSON.parse (<anonymous>)\n at pfs_1.readFile.then.contents (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:81639:45)\n at <anonymous>\n at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27625), <anonymous>:56921:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

DeviousFusion avatar Mar 16 '19 10:03 DeviousFusion

Same error using MacOS Mojave. Running from the binary works even with the same error, so, maybe is related to another thing. 🤔

gugadev avatar Mar 16 '19 19:03 gugadev

Anyone found a workaround ?? This problem still exists Tried everything from specifying different folder to creating the file manually.

I always prefer binary file compared to docker. Seems like NO one is able to use the binary file installation.

avgcoderlife avatar Mar 17 '19 13:03 avgcoderlife

@adithyau I don't have problems running from the binary one, but from docker. That's curious.

gugadev avatar Mar 17 '19 13:03 gugadev

When using the docker command shown on the homepage, I've worked around this error by additionally mounting /root/.local to a path or a volume:

$ docker run -t -p 8443:8443 -v "$(pwd)/.coder:/root/.local" -v "$(pwd):/root/project" codercom/code-server code-server --allow-http --no-auth

Note: above command is insecure, use only for testing locally and always review the security documentation provided.

Cheers.

luislavena avatar Mar 18 '19 16:03 luislavena

/root/.local/share/code-server/Backups/workspaces.json Have you tried overwriting the entire file?

ricohgag avatar Mar 19 '19 02:03 ricohgag

This error shouldn't actually cause any issues. Not sure if we should suppress it.

kylecarbs avatar Mar 19 '19 20:03 kylecarbs

Originally, I couldn't load it out with black screen, but later I updated the configuration of nginx, so that vs code could be loaded out on the web page。 TIM截图20190320085839

ricohgag avatar Mar 20 '19 01:03 ricohgag

Same error using GCP,

  • code-server version: v1.32.0-310
  • OS Version:Ubuntu 16.04.1 LTS

Lawrence1108 avatar Mar 20 '19 01:03 Lawrence1108

Ran into a similar issue, but noticed that when I opened the page in "Incognito" mode, it worked. I suspect that some state is getting saved into the browsers local storage. Clearing it seemed to solve the problem.

In Chrome you can clear a single site with: Developer Tools > Application (tab) > Clear storage

Edit: This is incorrect. As @kylecarbs pointed out below, it's related to an invalid folder. Please ignore.

mdp avatar Mar 20 '19 02:03 mdp

@mdp that's an issue with opening an invalid folder. We've fixed that on master. Will come in a release later today.

kylecarbs avatar Mar 20 '19 14:03 kylecarbs