Closed neunygph closed 5 years ago
Hey @neunygph , you can only open a terminal in a server sandbox, you can read this article for more info.
Ah I see, thank you.
In other news, CodeSandbox Containers is out of beta as of today! 🙂
Closing this, if you're interested in more details about this feature, you can also find us on Spectrum .
In case this helps anyone: to enable containers for an existing project you need to create a sandbox.config.json
file with the following content before creating the sandbox:
{
"template": "node"
}
I'm not sure if there is a way to change the sandbox once it's created.
Terminal is not showing up in codesandboxes for me, and this is long after the containers update. How can I get a terminal in a sandbox now?
Hey @djnorrisdev ,
In order to open a terminal you need a server sandbox that you own - meaning that you created it by forking an existing sandbox / template (as a note, you don't own GitHub imported sandboxes, even if you own the repository).
For example, go to the node
template - https://codesandbox.io/s/node , fork it, and to open a terminal, press on the right +
icon in the "Terminal" pane:
@zommerfelds
I'm not sure if there is a way to change the sandbox once it's created.
There isn't one for now, but it's definitely high up on our roadmap!
@Ibogdan,
Thanks, I was trying to get access to be able to npm or yarn install a privately hosted npm package. I’m guessing that’s not possible yet?
Any update on this, especially Terminal access on imported GitHub projects? Surely if I import my own GitHub project I should have the ability to run npm/yarn commands from a terminal window.
@JoeEarly You can already use a terminal on imported GitHub projects and do that - it's just that the terminal is only available to container sandboxes - See https://codesandbox.io/docs/environment for more info.
@garethx I imported a GitHub project last night and it seems to have defaulted to client. How do I ensure an imported github project starts as a Container? Your link stats Currently it is not possible to convert a Client Sandbox to a Container Sandbox.
Hey @JoeEarly ,
You can add a sandbox.config.json
to the root of the repository with the contents:
{
"template": "node"
}
Example: https://github.com/lbogdan/csb-vue-vite/blob/master/sandbox.config.json (that's using the nuxt
template, which is also a container template, and there's also next
, which is useful for React / Next apps).
Ok tried that but for some reason using the CodeSandbox UI, I don't have a node option in the dropdown and when editing with the editor, placing in node, it has no effect.
You can't change non-GitHub imported sandboxes between client and container environments. In case of GitHub imported sandboxes, adding the sandbox.config.json
file and re-importing the repo should update the sandbox environment.
You can't change non-GitHub imported sandboxes between client and container environments. In case of GitHub imported sandboxes, adding the
sandbox.config.json
file and re-importing the repo should update the sandbox environment.
How do you re-import the repo?
I think "re-import the repo" really means add the sandbox.config.json
file to the repo, delete the original sandbox, create a new one, and then import the repo.
Steps that worked for me to ensure that a sandbox has a terminal:
sandbox.config.json
to the root of the GitHub repo with the contents:
{
"template": "node"
}
Make sure this change is pushed up to the GitHub repo before you proceed.
But I get a -- 502: Bad Gateway -- and the container fails to start. Followed the 3 steps detailed by alexnitta above
@alexnitta Thanks, it works! It's quite sad that I'll now have to migrate sandboxes, but oh well.
Is it possible to add a terminal to an existing react codesandbox?
@didymus707 no 😔
Hi, I'm new to codesandbox and I"m wondering how to open a terminal in order to run a npm command. I looked about my sandbox but I couldn't find any option to open a terminal.
Thanks,