danger pr throwing "Cannot find module 'package.json'"
See original GitHub issue👋 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?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:13 (11 by maintainers)
Top Results From Across the Web
6 - Stack Overflow
However, every time I install something globally, it does not update the package.json file, but does install it in /usr/local/lib/node_modules.
Read more >Solved: CLD200 - Manual Deployment keeps erroring out
When I run the cf push command, I get the below error: user: risk-management $ cf ... Installing node modules (package.json + package-lock.json)....
Read more >patch-package - npm
json. If it's a transitive dependency patch-package can't detect that it is safe to ignore and will throw an error. To fix this,...
Read more >Danger JS
Danger is a NPM module that evals a Dangerfile . You set up a Dangerfile per-project. The Dangerfile contains a collection of home-grown...
Read more >rollup.js
json file. If your package.json file also has a module field, ES-module-aware tools like Rollup and webpack 2+ will import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 withdanger pr
👍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.