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

Error: Cannot find module '@actions/core' #3

Closed
oliwheeler opened this issue Nov 14, 2019 · 7 comments
Closed

Error: Cannot find module '@actions/core' #3

oliwheeler opened this issue Nov 14, 2019 · 7 comments

Comments

@oliwheeler
Copy link

Repo Steps:

  1. Use azure/docker-login@master (commit ed03ba4fc617589298156ade22efab93820817b0).
  2. Observe error:

azure-docker-login-error

@alinnert
Copy link

alinnert commented Dec 1, 2019

The documentation explicitly states that you need to commit your node_modules folder as well.

I also stumbled over this. I can imagine this is a) because of performance and b) to make sure everyone uses the exact same dependencies, so the action will always work the same way.

@thesattiraju
Copy link
Contributor

The node_modules are checked into the releases branch. You could use azure/docker-login@v1 instead for your workflows.
@RoopeshNair could you guide them about why we had to remove the node_modules from the master branch?

@RoopeshNair
Copy link
Contributor

@alinnert The master branch has the latest code and is unstable to bind to since a breaking new major version may first get implemented in master.

@cjonasw
Copy link

cjonasw commented May 14, 2020

You could just get the action to install the dependencies, granted it isn't as fast but at least you don't need to commit dependencies. This worked for me. NPM looks after making sure everyone has the correct dependency version; that's what the lock file is for.

JeroenBos added a commit to JeroenBos/docker-login that referenced this issue Aug 11, 2020
@emmahsax
Copy link

emmahsax commented Nov 8, 2020

@cjonasw How do I have the action load the dependencies? I'm assuming based on a package-lock.json file or something? I have an action that I've forked somebody else, and am making changes, and it's just too crazy to try to commit all of the node_modules all the time. Nobody else uses my fork (to my knowledge), and I'd like to do the auto-loading despite it potentially being a little slower.

Here's my PR. Is there a code snippet or something I need to add to the main JS file?


EDIT: Oh, actually a little more googling found the answer, I believe! actions/typescript-action#4 (comment) is the answer!

@xgqfrms
Copy link

xgqfrms commented Aug 18, 2022

The documentation explicitly states that you need to commit your node_modules folder as well.

I also stumbled over this. I can imagine this is a) because of performance and b) to make sure everyone uses the exact same dependencies, so the action will always work the same way.

Do you mean not ignoring the node_modules folder when publishing your release?

why not install the dependencies, in your action.yml file

@alinnert
Copy link

@xgqfrms The structure of this action.yml file is different. The code doesn't get executed via jobs but via a runs property. You can also see this in the docs page I've linked. So you cannot add a npm install step before your code runs.

Also, this would make your action depend on npm. If npm is down your action doesn't work either. I can totally see why it has been done this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants