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

ActionHero cannot be installed globally #1141

Closed
evantahler opened this issue Oct 16, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@evantahler
Copy link
Member

commented Oct 16, 2017

If you install actionhero globally npm install -g actionhero you can generate projects and run some of the CLI commands. However, you no longer can run the server (npm start).

“actionhero” (the globally installed binary) has created the API object form /global/actionhero/index.js and has loaded all the initializers and added them there. But then when you hit a file in your local project, it does require('actionhero') In that local file, it loads /project/node_modules/actionhero/index.js, and that file’s .api = {}. (edited)

I think the solution is in every class file rather than a simple require(../index.js) we actually need to check the folder structure of the local environment (project_root) and load from there rather than just the relative index.js

  • ActionHero Version: 18.x.x
  • Node.js Version: all
  • Operating System: all
@evantahler

This comment has been minimized.

Copy link
Member Author

commented Aug 23, 2018

Upon much reflection... we should not support this. We should actually throw a warning if actionhero is installed globally.

@evantahler

This comment has been minimized.

Copy link
Member Author

commented Aug 23, 2018

This can be accomplished with the detect-installed package

@aurasalexander

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2019

Hey,
I think it's absolutely okay to decide to not support a global npm installation. But instead of adding another dependency tree (detect-installed) just to print a warning for this edge case, I would opt for a clear statement in the documentation.

I know that there is already a hint on this at https://www.actionherojs.com/get-started/, but it's kind of hidden there. I feel like it should be mentioned in the main documentation under https://docs.actionherojs.com.

Therefore I would suggest to insert a subordinate clause in the quickstart section which indicates that a global installation is not supported. Furthermore, you could link to this issue in the existing hint on the get-started page.

@evantahler

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

@evantahler evantahler closed this Jun 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.