Skip to content

Error: Cannot find module #956

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

Closed
pOoOf opened this issue Aug 1, 2019 · 4 comments
Closed

Error: Cannot find module #956

pOoOf opened this issue Aug 1, 2019 · 4 comments

Comments

@pOoOf
Copy link

pOoOf commented Aug 1, 2019

Node version (or tell us if you're using electron or some other framework):

v8.10.0

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.3

Operating system:

Ubuntu

Description of the bug:

I am using shelljs to execute git commands in the jenkins build server and it works fine most of the time, shelljs is breaking randomly and i am not sure what is causing this error, here is the stack trace

Error: Cannot find module '/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/node_modules/shelljs/src/exec-child.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/node_modules/shelljs/src/common.js:399
        throw e;
        ^

ShellJSInternalError: ENOENT: no such file or directory, open '/tmp/shelljs_b8257e7bea931a3aa31d'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at execSync (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/node_modules/shelljs/src/exec.js:89:17)
    at Object._exec (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/node_modules/shelljs/src/exec.js:205:12)
    at Object.exec (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/node_modules/shelljs/src/common.js:335:23)
    at Object.getTags (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/lib/gitUtils.js:58:20)
    at Pipeline.process (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/lib/pipeline.js:62:23)
    at Object.<anonymous> (/home/jenkins/.nvm/versions/node/v8.10.0/lib/node_modules/changelog/bin/changelog.js:40:20)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)

Example ShellJS command to reproduce the error:

shell.exec(git tag -l --sort=-v:refname, {async:false, silent: !this.logging});

@nfischer
Copy link
Member

nfischer commented Aug 2, 2019

There's something seriously wrong if shell.exec() can't find exec-child.js. This is one of the files in our module, so it should definitely be on the file system. This sounds like a package manager bug to me, or something else is deleting the file out from under you.

@pOoOf
Copy link
Author

pOoOf commented Aug 2, 2019

and what does this line means

ShellJSInternalError: ENOENT: no such file or directory, open '/tmp/shelljs_b8257e7bea931a3aa31d'

Is there is anything from my side that i can try

@nfischer
Copy link
Member

nfischer commented Aug 2, 2019

I think that's one of the temp files we use to plumb stdio to/from the child process. I think, when we can't find the child-exec.js module, we try to throw an exception using the stderr value for the message. But there might be no stderr if child-exec.js never runs, so we're hitting a double error.

I think the main issue is still that we can't find child-exec.js though, and I don't think the "double error" is itself an issue, since it's reasonable to expect all our files to be there.

Is this something you can repro locally? I'm worried the flakiness will make this hard to investigate (I've never seen the issue locally or on our own CI).

@pOoOf
Copy link
Author

pOoOf commented Aug 6, 2019

Okay thanks, since this is happening quite randomly on cicd server, will try to reproduce this locally and if happens, will update it here.

@pOoOf pOoOf closed this as completed Aug 6, 2019
marcoreni added a commit to marcoreni/docs-publisher-action that referenced this issue Aug 20, 2021
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

2 participants