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

danger pr throwing "Cannot find module 'package.json'" #261

Closed
kanaabe opened this issue May 24, 2017 · 13 comments
Closed

danger pr throwing "Cannot find module 'package.json'" #261

kanaabe opened this issue May 24, 2017 · 13 comments

Comments

@kanaabe
Copy link

kanaabe commented May 24, 2017

👋 I'm currently trying to add danger to my project. I've set up my dangerfile.js as so:

const { danger, fail } = require('danger')

const someoneAssigned = danger.github.pr.assignee
if (someoneAssigned === null) {
  fail("Please assign someone to merge this PR, and optionally include people who should review.")
}

and if I run danger pr I get back an error:

> danger pr https://github.com/artsy/positron/pull/1
(node:97283) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Cannot find module 'package.json'
(node:97283) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have danger installed both globally and to my project repo. My local version of Node is v7.10.0. Any thoughts?

@frozegnome
Copy link
Contributor

I am also having the same issue during my CI build on my application after greenkeeper updated danger to the latest version (0.19)

+1

@kwonoj
Copy link
Member

kwonoj commented Jun 2, 2017

check jestjs/jest#3723, this seems babel-jest side issue.

@orta
Copy link
Member

orta commented Jun 3, 2017

Thanks @kwonoj :D

@orta orta mentioned this issue Jun 9, 2017
11 tasks
@threeve
Copy link

threeve commented Jun 14, 2017

This really bummed me out just now trying to set up danger on our project finally. Until the new version of Jest is released it seems that a simple workaround is to ensure you have a .babelrc file in your project containing simply an empty json object {}. With that in place I'm able to get danger working both on jenkins and locally with danger pr 👍

@orta
Copy link
Member

orta commented Jun 24, 2017

We ended up working around this in Artsy by moving to Peril - https://github.com/danger/peril

@hramos
Copy link

hramos commented Jul 12, 2017

I've been running into this as well. Looks like this is fixed in jest#master, and the fix is available in Jest 20.1.0-alpha.3. I'm guessing we won't want to move Danger to an alpha release just yet, so we'll need to wait for the final Jest 20.1.0 release to become available.

tivac added a commit to tivac/mithril.js that referenced this issue Jul 19, 2017
Also includes a bogus .babelrc to solve danger/danger-js#261 until it is released.
@hawkrives
Copy link
Contributor

I'm running in to this error when I'm just running danger in TravisCI – should I just wait for a release that includes Jest 20.1?

@kwonoj
Copy link
Member

kwonoj commented Aug 8, 2017

@hawkrives
Copy link
Contributor

@kwonoj I'll try that, thanks!

@macklinu
Copy link
Member

I was going to suggest adding solutions to the troubleshooting guide, but I believe this won't be a problem with danger 2.0, since we're moving away from Jest as the Dangerfile evaluator. Is this your understanding as well, @orta?

@hawkrives
Copy link
Contributor

(@macklinu I should note that I no longer encounter any problems since upgrading to the danger@2 prereleases.)

@orta
Copy link
Member

orta commented Aug 18, 2017

Yes, this shouldn't be a problem then 👍

@orta
Copy link
Member

orta commented Sep 21, 2018

OK, I'm going to call this as sorted since Danger doesn't use jest under the hood anymore. 👍

@orta orta closed this as completed Sep 21, 2018
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

8 participants