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

child_process throwing error ('"cwd" must be a string') #57

Closed
MeanTeam opened this issue Jun 2, 2017 · 24 comments
Closed

child_process throwing error ('"cwd" must be a string') #57

MeanTeam opened this issue Jun 2, 2017 · 24 comments

Comments

@MeanTeam
Copy link

MeanTeam commented Jun 2, 2017

throw new TypeError('"cwd" must be a string');
TypeError: "cwd" must be a string
at normalizeSpawnArguments (child_process.js:380:11)
at exports.spawn (child_process.js:465:38)

The problem comes from cwd: process.cwd,
I am thinking this could be solved executing the function to get the current path directory string: cwd: process.cwd(),

Using node 8.0.0 and npm 5.0.1

@evolutionxbox
Copy link

Also using node 8.0.0 and npm 5.0.0

I've tried reinstalling parallelshell, but am met with another error

node-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.1/fse-v1.1.1-node-v57-darwin-x64.tar.gz
node-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.1/fse-v1.1.1-node-v57-darwin-x64.tar.gz

Are they related?

@PierBover
Copy link

Same here... using Node 8 and NPM 5.0.1

@darkguy2008
Copy link
Owner

darkguy2008 commented Jun 6, 2017

I've fixed it and made my own fork here: https://github.com/darkguy2008/parallelshell, I've also updated all the package.json libraries and made it work with latest mocha.

Unfortunately I have no idea how to push this to npm... and npm-run-all doesn't cut it, I like paralleshell as it doesn't need me to install something globally, and it works pretty well... it just needed some small fixes for Node 8.0. I'd rather use and maintain something that just works...

@PierBover
Copy link

I moved to npm-run-all and it didn't require me to install anything globally.

@darkguy2008
Copy link
Owner

Yeah but the syntax and all looks different, and the documentation doesn't help me to understand how to use it (or how to migrate from parallelshell), so I'd rather use my own fixed version :/

@PierBover
Copy link

To run scripts in parallel:
run-p some-npm-script some-other-npm-script

@darkguy2008
Copy link
Owner

Well, that worked! the documentation for npm-run-all was really confusing, your example was very clear and concise. Thanks!. Ah well, I still fixed the error in parallelshell haha, in case anyone is interested I'll keep the github repo :)

@keithamus
Copy link
Collaborator

@darkguy2008 if you'd like I'd be happy to give you the commit bit for this repo, which would allow you to publish the fix for the canonical parallelshell npm package.

@darkguy2008
Copy link
Owner

@keithamus Hello Keith, oh really? :O that would be awesome! I could also submit a PR if you wish. In any case, I'd be really happy to help :) let me know what do you prefer so I can prepare the files with the fix 👍

@keithamus
Copy link
Collaborator

keithamus commented Jun 6, 2017

@darkguy2008 you've been invited 😄. Feel free to manage the repo how you want! I'll give you publish rights on npm also if you give me your npm username.

@darkguy2008
Copy link
Owner

darkguy2008 commented Jun 6, 2017

Awesome! Thanks a lot :) I'll take good care of it :D Sure, my npm username is the same one as here, darkguy2008. I needed to use it on a project so I made a package (parallelshell-v8) using my branch, I'll delete it now that I have access here and apply the fixes in your repo. Thanks again! 👍 I'll do it when I'm back home, as I'm at work atm.

dstucki added a commit to webplatformz/challenge that referenced this issue Jun 12, 2017
@maoberlehner
Copy link

@darkguy2008 working long hours, huh? ;)

Would be cool if this gets fixed in the not so distant future. Let me know if I can help.

@darkguy2008
Copy link
Owner

@maoberlehner Hello! Kind of haha, I had some very busy days lately, however, don't worry, I'm kinda free today so I'll do it in the upcoming hours - stay tuned :D !

@darkguy2008
Copy link
Owner

darkguy2008 commented Jun 13, 2017

This has been fixed :). Closing issue!

screen shot 2017-06-12 at 7 56 02 pm

@maoberlehner
Copy link

Thx for fixing this. Please do not forget to publish a new release on npm. thx :)

@darkguy2008
Copy link
Owner

@maoberlehner you're welcome! I've just published a new version of the package :)

@jimmynotjim
Copy link

Thanks for this fix, I came here for the same issue.

Could you add the release on GitHub so it's clear v2.0.0 isn't the latest if you arrive here instead of the NPM listing. Thanks.

hkniberg added a commit to sveasmart/meter that referenced this issue Jan 9, 2018
darkguy2008/parallelshell#57

-------------------
> meter@1.0.0 start /Users/kniberg/Documents/Henrik/sveasmart/meter
> parallelshell 'node src/start.js' 'node src/start_pulse_detector.js'

child_process.js:400
    throw new TypeError('"cwd" must be a string');
    ^

TypeError: "cwd" must be a string
    at normalizeSpawnArguments (child_process.js:400:11)
    at exports.spawn (child_process.js:493:38)
    at /Users/kniberg/Documents/Henrik/sveasmart/meter/node_modules/parallelshell/index.js:104:17
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/kniberg/Documents/Henrik/sveasmart/meter/node_modules/parallelshell/index.js:100:6)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
ArtBIT added a commit to wix-incubator/Safeframe that referenced this issue Mar 25, 2018
@zeratax
Copy link

zeratax commented May 10, 2018

it seems like this is an issue again with node 10.1.0

$ parallelshell "echo 1" "echo 2" 
child_process.js:413
    throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
    at normalizeSpawnArguments (child_process.js:413:11)
    at spawn (child_process.js:515:38)
    at /home/user/.nvm/versions/node/v10.1.0/lib/node_modules/parallelshell/index.js:104:17
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/user/.nvm/versions/node/v10.1.0/lib/node_modules/parallelshell/index.js:100:6)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
$ node --version
v10.1.0

@powelmaja
Copy link

@zeratax I had the same for node 10.x. Downgrade of parallelshell to 3.0.1 helped for me.

marcjansen added a commit to geoext/geoext3-ws that referenced this issue May 24, 2018
Funny enough, v3.0.2 (the most recent version of parallelshell) is not
working, see darkguy2008/parallelshell#57 (comment)
@burns-brian
Copy link

I had the same issue, and @zeratax is correct. "Downgrade of parallelshell to 3.0.1" is the workaround. The problem is with 3.0.2.

mrzool added a commit to mrzool/mrzool.github.io that referenced this issue Sep 1, 2018
ara4n added a commit to element-hq/element-web that referenced this issue Sep 4, 2018
ara4n added a commit to matrix-org/matrix-react-sdk that referenced this issue Sep 4, 2018
ara4n added a commit to element-hq/element-web that referenced this issue Sep 9, 2018
ara4n added a commit to matrix-org/matrix-react-sdk that referenced this issue Sep 9, 2018
@jydoskey
Copy link

jydoskey commented May 20, 2019

thanks @powelmaja this issue is with parallelshell 3.0.2, had to downgrade to 3.0.1 and its working perfectly well

@tKartik
Copy link

tKartik commented Jun 7, 2019

@zeratax I had the same for node 10.x. Downgrade of parallelshell to 3.0.1 helped for me.

Thankyou so much for this!

@mametur
Copy link

mametur commented Apr 24, 2020

saleh63 added a commit to saleh63/bootstrap that referenced this issue Dec 10, 2020
@pm0u
Copy link

pm0u commented Jul 6, 2021

Can this be re-opened? Still happening to me, node 14.16.0 -- downgrading to 3.0.1 fixed

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