JS Action: Cannot find module

I was going through this Github lab and was at stage “Having Actions tell a joke… or two”. 

After completing the Action, I realized that Action Two doesn’t run. The error message was

<font color="#000000">Error: Cannot find module 'request-promise'</font>

I assumed that any dependencies would be automatically installed when action.yml specified running a “nodeX”. actions/core seems to be working well for Action One though. Just curious as to why is this happening.

Thank you.

Hi @shaunlwm,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.

As you’ll notice, your topic is now here in the GitHub learning lab board. No action is needed on your part; you can continue the conversation as normal here.

Cheers!

1 Like

@shaunlwm Thanks for bringing this to our attention.  

I took a quick look at your repository and didn’t see any node_modules  for the joke action.  Although we don’t typically commit node_modules  to a repository, for the purposes of this course you will need to do so.

The request  and request-promise  libraries are install locally when you run npm install request request-promise in a preivous instruction.  I see that this step was completed properly since your  package.json contains those dependencies. 

The workflow does not run any sort of npm install which is why you need to commit the node_modules , your package.json will never be read by the environment during the duration of this course.

1 Like

Ah, alright that was a mind fart moment right there. No wonder it stopped working as soon as I added the .gitignore files for the node_modules folder.

Thank you so much, and have a nice week ahead :slight_smile: