gh-pages: The "path" argument must be of type string. Received type undefined
I’m currently getting this error when I try to use gh-pages:
The "path" argument must be of type string. Received type undefined
There’s a previous issue that’s similar to this (#308) and I saw that it was already fixed in the latest versions. I’m currently using gh-pages@2.2.0. My node version is v12.7.0 and my npm version is 6.10.0.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 24
- Comments: 15 (1 by maintainers)
Commits related to this issue
- use gh-pages@3.0.0 because of https://github.com/tschaub/gh-pages/issues/354 — committed to psyplot/examples by Chilipp 6 years ago
- Use v3.0.0 of gh-pages for publishing To work around https://github.com/tschaub/gh-pages/issues/354. — committed to ahuth/ahuth.github.io by ahuth 6 years ago
- CI: Use gh-pages@3.0.0 due to tschaub/gh-pages#354 — committed to nipype/pydra by effigies 6 years ago
- pin gh-pages to 3.0.0 to avoid https://github.com/tschaub/gh-pages/issues/354 — committed to mne-tools/mne-bids by sappelhoff 6 years ago
- Specify CACHE_DIR for gh-pages - https://github.com/tschaub/gh-pages/issues/354 — committed to yous/yous.be by yous 5 years ago
- try to fix npx error https://github.com/tschaub/gh-pages/issues/354#issuecomment-2259294808 — committed to emcee5601/mftc-old by deleted user a year ago
Is anyone else getting the same error?
I am getting the same error. I dived into the code and I think I found the issue.
It´s on index.js:116.
The
getCacheDirreturns undefined in my case. Diving deeper, I found out it uses thefind-cache-dirpackage, which has the following comment on the code:I don’t have a package.json file in my project. that´s why I think I am getting undefined.
This only happens on 3.1.0. 3.0.0 works fine,
I was getting this error after the 3.1.0 update. Rolled back to 3.0.0 and everything worked OK.
What solved it for us was just running a
touch package.jsonprior to executinggh-pagesin our CI/CD pipeline, not an elegant solution but it did work for us.Still getting this error! Trying to publish without a package.json breaks it.
Still getting the same issue any idea why??
reading the release notes for 3.1.0
perhaps this issue can be solved by making a new (temporary) dir and passing it to a
CACHE_DIRenv variable.Adding
--dist .fixed the error for me.I was getting this error with gh-pages 5.0.0, whether running via npm script,
npx, ornode ./node_modules/gh-pages/bin/gh-pages.js, with or without arguments, withpackage.jsonpresent:Debugging this with VS Code launch.json…
I found that was failing here:
program.distisundefinedBy the way, this sort of error would be easier to track down if it logged the
err.stackinstead oferr.messagehere. If there are other errors where only the message is desired, treat them as a special case.