Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

cannot find module hello.js

Hi I lost connection while on training. The Cloud Shell command nodemon hello.js is giving Cannot find module ‘/home/xxxx/hello.js’

2 Answers

It should not disappear for that reason. Moreover, you can rerun git clone https://xxx  command and it will copy it again.  Make sure you run it  after cd to /home/xxxx folder.

Bit late to the party on this one, but for anyone else facing this issue in the future I’d suggest a this process:

~ Ensure you’re in the correct working directory and that the files are still there using the below commands:

~/gcp-cloud-engineer/cloud-shell-hello (user-project-01)$ pwd && ls

This will return 2 outputs as below:

Current dir: /home//gcp-cloud-engineer/cloud-shell-hello

All files in the current dir:
hello.js html-hello.js

From looking at the above example, I think you are trying to run this without having navigated into the gcp-cloud-engineer folder before running the node command

Should this still not work, clear any left-over files of a potentially corrupt clone and re-pull from git using the below command
rm -rf /home//gcp-cloud-engineer && git clone https://github.com/ACloudGuru/gcp-cloud-engineer

Hope this helps

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?