Cannot find module "package.json" error on CircleCI
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 381
- Avg merge
- 2h 8m
- Merged PRs (30d)
- 6
Description
Hello,
I'm getting the following error when running Danger on Node 8.1 for CircleCI:
```
OK, everything looks good: Circle CI on GitHub
Danger has errored
{ Error: Cannot find module 'package.json'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at getBabelRC (/usr/local/share/.config/yarn/global/node_modules/babel-jest/build/index.js:53:41)
at Object.getCacheKey (/usr/local/share/.config/yarn/global/node_modules/babel-jest/build/index.js:90:14)
at ScriptTransformer._getCacheKey (/usr/local/share/.config/yarn/global/node_modules/jest-runtime/build/ScriptTransformer.js:68:26)
at ScriptTransformer._getFileCachePath (/usr/local/share/.config/yarn/global/node_modules/jest-runtime/build/ScriptTransformer.js:93:27)
at ScriptTransformer.transformSource (/usr/local/share/.config/yarn/global/node_modules/jest-runtime/build/ScriptTransformer.js:182:32)
at ScriptTransformer._transformAndBuildScript (/usr/local/share/.config/yarn/global/node_modules/jest-runtime/build/ScriptTransformer.js:275:40) code: 'MODULE_NOT_FOUND' }
Request failed [404]: https://api.github.com/repos/Vacasa/danger-docker/statuses/874dfba667d3371001584d3c6a4bcf8684ef19a3
Response: {
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3/repos/statuses/#create-a-status"
}
```
I've tried stripping down my logic to the bare minimum. The Dockerfile definition:
```
FROM node:8.1
# Install Danger
RUN yarn global add danger@1.2.0 \
&& danger --version
```
And the CircleCI configuration that runs Danger:
```
if [ ! -z $CI_PULL_REQUEST ] && [ ! -z $DANGER_GITHUB_API_TOKEN ]; then
danger run
fi
```
The dangerfile is empty.
Any ideas what this error may be alluding to?
Contributor guide
Research direction
Reproduce the failure using the shown Dockerfile with Node 8.1, globally installed danger@1.2.0, and the CircleCI command that runs danger. Start with the babel-jest stack and the GitHub status request; done means identifying the cause of both reported failures and documenting or implementing a confirmed fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, node.js
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100