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

Support monorepo with NPM Workspaces #598

Closed
marlun78 opened this issue Jul 13, 2022 · 6 comments
Closed

Support monorepo with NPM Workspaces #598

marlun78 opened this issue Jul 13, 2022 · 6 comments
Labels
blocked A fix is dependant on a separate change/feature. feature request revisit Revisit the issue once a separate change/feature is merged.

Comments

@marlun78
Copy link

Is your feature request related to a problem? Please describe.

Currently, it is not possible to run fastly compute serve inside a monorepo with NPM Workspaces as demonstrated by this sample repo. A @fastly/js-compute not found in package.json error is thrown.

➜  fastly-error git:(main) npm run start:client   

> [email protected] start:client
> npm start -w packages/client

> @package/[email protected] start
> fastly compute serve

✓ Initializing...
✓ Verifying package manifest...
✗ Verifying local javascript toolchain...

ERROR: `@fastly/js-compute` not found in package.json.

To fix this error, run the following command:

        $ npm install --save-dev @fastly/js-compute
npm ERR! Lifecycle script `start` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @package/[email protected] 
npm ERR!   at location: [...]/fastly-error/packages/client 

I guess the issue is that when in a monorepo, the node_modules is on the root level and the relevant script runs in the context of a child-package (where also the relevant package.json is).

Describe the solution you'd like

I don't know the reason it's build as it is today, but I've never before come across another NPM package that inspects the package.json file to make sure dependencies are added. It seems to me to miss the target. The relevant question is rather if the dependency is installed or not and the best way to find out is by using it, right?

Additional context

NPM Workspaces
Related to package @fastly/js-compute
Related to issue #359

@Integralist
Copy link
Collaborator

Hi @marlun78

We've been working on the following PR for a while now to try and address issues with the Fastly CLI build process:
#640

Once this is merged (and released) I'll ping back in this ticket so you can upgrade and see if the changes work better for your situation. If not, then we can continue the discussion.

Thanks.

@Integralist Integralist added blocked A fix is dependant on a separate change/feature. revisit Revisit the issue once a separate change/feature is merged. labels Sep 28, 2022
@Integralist
Copy link
Collaborator

Integralist commented Oct 13, 2022

Hi @marlun78

Apologies, I just realised I said I would report back once #640 had been merged. Since that PR was merged I was discussing some similar issues internally with a colleague and so #671 is currently in the works which I think might actually resolve this issue.

Just an FYI that this issue will be closed automatically once that PR is merged.

@Integralist
Copy link
Collaborator

Closing due to #765 (this issue would have been automatically closed but I had to create a new PR and I neglected to include a reference to this issue).

@domdomegg
Copy link

@Integralist could you clarify how to use #765?

Unfortunately hitting the same issue, also in an NPM workspace.

@Integralist
Copy link
Collaborator

Hi @domdomegg

I'm sorry to hear you are having issues.

Since this issue was closed the CLI has undergone some fundamental changes that have resulted in us stripping out a bunch of 'user environment' validation logic (see this PR recently merged). I haven't got these changes out into a new release yet (they'll be part of a 6.0.0 release of the CLI) but I believe that PR will help provide much greater flexibility to users in general.

@domdomegg
Copy link

Ah, thanks for the update! I'll wait for 6.0.0 in that case.

For now I've just disabled the verification for now, with:

fastly compute serve --skip-verification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked A fix is dependant on a separate change/feature. feature request revisit Revisit the issue once a separate change/feature is merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants