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

Node_modules get cleared with package name missing error in the custom plugin for Reaciton Api. #6246

Closed
3 tasks done
ankurpata opened this issue May 12, 2020 · 7 comments
Closed
3 tasks done
Labels
bug For issues that describe a defect or regression in the released software priority medium severity low

Comments

@ankurpata
Copy link

ankurpata commented May 12, 2020

Prerequisites

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue? [Search issues]

Issue Description

When tried to add a new dependency on to plugin in the package.json, the make init-devcommand on reaction root directory should install all the dependencies provided in the custom plugin. Instead it clear the node_modules and fails to install again.
Screenshots of node_modules and package.json in the custom plugin:
image
image

Error on Reaction api Docker logs:
image

Steps to Reproduce

  1. Create a custom plugin and integrate it with Reaction Api.
  2. Add dev dependencies like node-rdkafka
  3. Try running make init-dev
  4. Fails installing custom plugin.

Possible Solution

I faced this issue on MacOs, the docker must be using node-gyp to install dependencies for any additional npm package. It might work if it installed using ubuntu.

Versions

3.7.0

@ankurpata ankurpata added bug For issues that describe a defect or regression in the released software needs triage For issues that are awaiting triage by the core development team labels May 12, 2020
@aldeed
Copy link
Contributor

aldeed commented May 17, 2020

@ankurpata It would be helpful if you can link to a repo with a simple reproduction of this. There could be a lot of things happening, and we'd need to see exactly how you're linking the plugin and exactly how it is listing its dependencies.

I notice you say Add dev dependencies. If that means that node-rdkafka is listed in devDependencies instead of dependencies then that's probably the issue. Only dependencies would be installed because that's how NPM works.

@aldeed aldeed added priority medium severity low and removed needs triage For issues that are awaiting triage by the core development team labels May 17, 2020
@loan-laux
Copy link
Collaborator

loan-laux commented May 17, 2020

@aldeed I'm having the same problem and I've created a flattened reproduction repo right here. Clone it, run make init-dev-reaction and you should run into the same issue as @ankurpata reported.

Also, I confirm that it's happening with production dependencies. If you run npm install in the @reactioncommerce/* directories from the host machine before starting reaction, their node_modules get wiped except for fsevents. Then Reaction throws an error about not being able to solve the packages' own deps (of course).

@loan-laux
Copy link
Collaborator

On another note, since this looks reproducible and prevents (some) developers from working on mounted NPM modules, I would suggest that it deserves at least a severity medium tag.

@aldeed
Copy link
Contributor

aldeed commented May 18, 2020

@loan-laux @ankurpata Oh I see! I did not realize this was referring to plugins linked through volume mounts. In that case, yes we're aware of this issue. There is really no solution we could find when using volume mounts, which is why I created a different solution for local plugin development here: #6238

Using that branch, you should be able to do make dev-reaction first and then copy in each local plugin using the new script while the API is running. That PR should be good to merge into trunk, but I wanted a few people to try it out and confirm it's working for more than just me.

I'm hoping to document this and other aspects of local development that have changed this week.

@loan-laux
Copy link
Collaborator

loan-laux commented May 18, 2020

@aldeed This works great and looks exactly like what we needed. Thank you so much! @ankurpata, if this works for you, please close this issue.

@ankurpata
Copy link
Author

Cool, I'll try this out and close this if it works.
Thanks @aldeed, @loan-laux

@nnnnat
Copy link
Contributor

nnnnat commented Jan 19, 2021

@ankurpata please re-open if this is still an issue for you.

@nnnnat nnnnat closed this as completed Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software priority medium severity low
Projects
None yet
Development

No branches or pull requests

4 participants