deploy.now icon indicating copy to clipboard operation
deploy.now copied to clipboard

Deploy fails when package.json does not contain a name field.

Open Haroenv opened this issue 7 years ago • 5 comments

I can't get it to work with any of the examples of algolia/react-instantsearch, I'm getting the error message "Deploy failed, please check the repo and try again."

Would love to add the buttons to our READMEs 😄

Haroenv avatar May 02 '17 15:05 Haroenv

Hey @Haroenv 👋 are you still running into this issue? If so could you post the full repo url you are trying to use? Thanks!

zpnk avatar Jun 02 '17 21:06 zpnk

Didn't try since. I'll try again tomorrow, but it's packages/examples/ any of those in there of Algolia/react-instantsearch

Haroenv avatar Jun 02 '17 21:06 Haroenv

https://github.com/algolia/react-instantsearch/tree/master/packages/react-instantsearch/examples/autocomplete gives me “deploy failed, please try again” repeatedly.

Haroenv avatar Jun 03 '17 12:06 Haroenv

@Haroenv Okay, so I did a bunch of digging into this issue and found a couple interesting things..

  • The main reason this deploy was failing was because the root package.json does not contain a name field.
  • We use download-package-tarball to download the github repo. For some reason, DPT uses npm-package-arg under the hood (looks like it tries to parse the package scope). If the package.json name field is empty, NPA throws.
  • I was able to deploy the above example by adding a name to the root package.json in algolia/react-instantsearch.

The short-term solution is to add a name here. I realize that this is unnecessary and a less-than-ideal solution, but it will allow you to deploy the examples.

The long-term and better solution would be for us to move away from download-package-tarball and write our own lib to handle that functionality. Now that I've examined the code for DPT, I don't like how it assumes a package.json and tries to parse the npm scope from it. We don't need either of these things, so our lib can be less complex. (side-node - deploying repos with package.json names like @name/some-thing is currently broken. I think it's related to how DPT tries to parse things, but again, that's completely unnecessary.)

Sorry you ran into this issue, but thanks for reporting it! I'm glad we were able to surface an underlying issue here. I will be making a new follow-up issue to log the removal of download-package-tarball.

For now, can you try making the above name change and redeploying?

zpnk avatar Jun 05 '17 20:06 zpnk

Sounds very thorough, I'll try that change

Haroenv avatar Jun 05 '17 20:06 Haroenv