1

I've faced a problem while trying to call child_process.exec from node_modules

My tool runs the cloned repo commands and my project structure looks like:

pre-check/
  .tmp/
    repo/
      node_modules/
        .bin/
          builder
      src/
      index.ts
  node_modules/
  index.ts

I tried to run

child_process.exec(
  '/home/m0sk1t/projects/pre-check/.tmp/repo/node_modules/.bin/builder package',
  {
    cwd: '/home/m0sk1t/projects/pre-check/.tmp/repo/'
  },
  ...callback...
);

So I expected to see the errors regarding to pre-check/.tmp/repo folder but i got the following errors(~20) for my tool's folder:

 error  TYPESCRIPT  /home/m0sk1t/projects/pre-check/node_modules/@types/node/events.d.ts : (21,39) Cannot find name 'unique'.

Any thoughts why this happens?

PS: I tried to run /home/m0sk1t/projects/pre-check/.tmp/repo/node_modules/.bin/builder package in terminal from /home/m0sk1t/projects/pre-check/.tmp/repo/ folder and got the same result

Mu-Majid
  • 851
  • 1
  • 9
  • 16
m0sk1t
  • 31
  • 8
  • check this answer out, I think this issue is related to what is mention. https://stackoverflow.com/questions/33332394/angular-and-typescript-cant-find-names-error-cannot-find-name – Mu-Majid Jul 24 '20 at 22:44
  • @Mu-Majid unfortunately no, actually the main issue in the exec paths, not the module errors – m0sk1t Jul 24 '20 at 22:57
  • Well i am not sure what `fs.exec` is? Do you mean the `child_process`' module's function `exec`? . if so, it might be a types problem. So check this answer out: https://stackoverflow.com/questions/31173738/typescript-getting-error-ts2304-cannot-find-name-require – Mu-Majid Jul 24 '20 at 23:06
  • @Mu-Majid oh, of course im using child_process.exec, you're right, i just typed a wrong module in the question (fixed) – m0sk1t Jul 24 '20 at 23:19
  • @Mu-Majid but still this is not the type error, i wonder why it runs outside the folder i want to use – m0sk1t Jul 24 '20 at 23:20

1 Answers1

0

nvm, there was an unexpected behavior in one of the node modules

m0sk1t
  • 31
  • 8