codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

Cannot run `codesandbox-client` and `dependency-packager` locally together

Open ParadeTo opened this issue 2 years ago • 3 comments

🐛 bug report

Preflight Checklist

  • [x] I have read the Contributing Guidelines for this project.
  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Description of the problem

I want to run codesandbox-client and dependency-packager locally together. Here is my steps:

  1. yarn run build and yarn run dev under dependency-packager project
  2. Replace bucket url by http://localhost:4545 at this line
  3. yarn run start under codesandbox-client project.
  4. When I create a React Application on http://localhost:3000. The terminal of dependency-packager report the error: image

How has this issue affected you? What are you trying to accomplish?

To Reproduce

Link to sandbox: None

Your Environment

Software Name/Version
Сodesandbox master branch
Browser Chrome 100.0.4896.88
Operating System MacOS Big Sur

ParadeTo avatar Apr 21 '22 09:04 ParadeTo

Hey @ParadeTo - It looks as though the application is looking for react 18.0.0 in. your NPM registry and not finding it, you may need to install this.

We have a guide on local installs as well (there are some aspects that need updating mind) that may be helpful: https://github.com/codesandbox/codesandbox-client/blob/master/CONTRIBUTING.md#setting-up-the-project-locally

JamesACS avatar May 03 '22 16:05 JamesACS

@JamesACS I think it is because the dependency-packager doesn't parse the right package name, then yarn add cannot install the package. And the guide just teach us how to start codesandbox-client locally (the request for package still send to remote server).

ParadeTo avatar May 11 '22 07:05 ParadeTo

Heya! Looking at this right now... I've not developed with a local version of dependency-packager before, I've always either developed them separately or deployed the packager to a dev url on AWS to test. But we should be able to make it work I think.

What if you replace this url (https://github.com/codesandbox/codesandbox-client/blob/master/packages/sandpack-core/src/npm/preloaded/fetch-dependencies.ts#L24-L25) with the localhost:4545 url, and immediately throw an error here? https://github.com/codesandbox/codesandbox-client/blob/master/packages/sandpack-core/src/npm/preloaded/fetch-dependencies.ts#L119. That would force us to use the packager instead of the S3 cache.

CompuIves avatar May 31 '22 10:05 CompuIves