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

The "file" argument must be of type string. Received type undefined #308

Closed
konsumer opened this issue Aug 1, 2019 · 22 comments · Fixed by #312
Closed

The "file" argument must be of type string. Received type undefined #308

konsumer opened this issue Aug 1, 2019 · 22 comments · Fixed by #312

Comments

@konsumer
Copy link

konsumer commented Aug 1, 2019

I have a directory dist/, when I run gh-pages --dist dist from my package.json, I get this error:

The "file" argument must be of type string. Received type undefined

node: v12.7.0
Ubuntu (Pop!_OS 19.04)
@theycallmeswift
Copy link

I'm also receiving this error.

node: 10.16.1
OSX 10.13.6

@sureshsevarthi
Copy link

sureshsevarthi commented Aug 1, 2019

Even I'm facing this error.

node: 10.16.1 OSX 10.14.6

@bakerTX
Copy link

bakerTX commented Aug 1, 2019

I am trying to deploy a fresh create-react-app to GitHub pages and I am getting this error now too.

node: 8.16.0
osx: 10.14.5
create-react-app: 3.0.1

@jamsea
Copy link

jamsea commented Aug 1, 2019

I think this might be an issue of one of gh-pages's dependencies. I did a mass search in the codebase for the word "file" and don't see anything that would be emitting that that error.

I also erased my yarn.lock file and regenerated it around 2 hours ago which is causing me to believe it's related to a subdependency

@hynra
Copy link

hynra commented Aug 1, 2019

I got this error too.

@jamsea
Copy link

jamsea commented Aug 1, 2019

Another hint, when I run:

NODE_DEBUG=gh-pages yarn deploy

I see this:

$ gh-pages --dist=build
GH-PAGES 91884: Cloning https://github.com/jamsea/react-swapi.git into node_modules/gh-pages/.cache/github.com!jamsea!react-swapi.git
The "file" argument must be of type string. Received type undefined
error Command failed with exit code 1.

But when I try opening up the node_modules folder nothing was cloned, maybe git related?

@lopopolo
Copy link

lopopolo commented Aug 1, 2019

The newly introduced --git argument seems to have no default value.

lopopolo added a commit to artichoke/ferrocarril that referenced this issue Aug 1, 2019
lopopolo added a commit to artichoke/cactusref that referenced this issue Aug 1, 2019
@lopopolo
Copy link

lopopolo commented Aug 1, 2019

Adding --git "$(which git)" to the args I pass gh-pages works around this issue.

lopopolo added a commit to artichoke/artichoke that referenced this issue Aug 1, 2019
@BjornoWalker
Copy link

Thanks for the help, I am having the same issue. Where are you supposed to add --git "$(which git)" exactly?

@the-simian
Copy link

the-simian commented Aug 1, 2019

@BjornoWalker I had problem with @lopopolo 's use of quotes, I used a command like this directly in the command line
npx gh-pages --dist gh-pages --git $(which git)

However this wasn't working when I stored it as a command in my package.json

@BjornoWalker
Copy link

@the-simian Thank you for the response. I'm not sure if it's something that i'm doing on my end, but it still won't work for me even without the quotations. I'm still getting the same The "file" argument must be of type string. Received type undefined.

@the-simian
Copy link

the-simian commented Aug 1, 2019

@BjornoWalker try just simply typing which git in the command line and see what comes back. I'm also messing with this trying to figure out how to set this as some sort of reusable npm script, which isn't working for me

I think my problem is related to windows spawning child process from an npm script, unfortunately. I can write a script like `get-git : "(which git)" and we're good. I put which git in another script in any way -nope.

There's probably some trick to this I'm overlooking

@BjornoWalker
Copy link

Thanks a lot, I was finally able to get it to work thanks to your advice! I'm going to keep looking into creating the reusable npm script also.

@iki
Copy link

iki commented Aug 1, 2019

@BjornoWalker also, if you don't want to hardcode the git path, you can use --git git as git is in PATH by default on most systems including Windows, OR you can downgrade to [email protected]

@jonybar9
Copy link

jonybar9 commented Aug 1, 2019

Am facing the same issue.
The work around you guys suggested throws for me:

Error: spawn $(which git) ENOENT

@d07RiV
Copy link

d07RiV commented Aug 1, 2019

Downgrading to 2.0.1 works.

klekowskim added a commit to klekowskim/wroclawjug-random-attendee-v2 that referenced this issue Aug 1, 2019
stonebk pushed a commit to zillow/drywall that referenced this issue Aug 1, 2019
@the-simian
Copy link

I spent more time on this today and the only thing that worked for me reliably was actually downgrading. My hope is that the non-inclusion of the git switch defaults to 2.0.1 behavior in a future release, but you can override that if you want

@AffiliateThis
Copy link

I tried updating both the package and lock with versions 2.0.1 and 2.1.0 and I am still getting the same error. I am a bit stumped here. This is just a basic react app. Any suggestions...

[email protected] deploy C:\Users\Chris\Desktop\URCoding\GitHub_Work\chrisksportfolio
gh-pages -d build

The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@jonybar9
Copy link

jonybar9 commented Aug 2, 2019

@AffiliateThis
Guessing you tried it already, but if you haven't:
-Delete node_modules
-Delete package-lock file
-In package.json -> dependencies -> delete gh-pages line

run npm i [email protected]
run npm i
try again.

@AffiliateThis
Copy link

I actually hadn't tried those steps. I tried a few other things, but thank-you. It actually worked. Something worked....True Happiness in Deployment.

@kartoos47
Copy link

Thanks..this works.

koki-sato added a commit to koki-sato/koki-sato.github.io that referenced this issue Aug 5, 2019
koki-sato added a commit to koki-sato/koki-sato.github.io that referenced this issue Aug 5, 2019
lrills added a commit to catinclay/BuuTennis that referenced this issue Aug 6, 2019
@tschaub
Copy link
Owner

tschaub commented Aug 8, 2019

The [email protected] release includes a fix for this.

koki-sato added a commit to koki-sato/koki-sato.github.io that referenced this issue Dec 20, 2020
koki-sato added a commit to koki-sato/koki-sato.github.io that referenced this issue Jan 8, 2023
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

Successfully merging a pull request may close this issue.