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

Example in README not working #2

Open
tlylt opened this issue Feb 17, 2023 · 3 comments
Open

Example in README not working #2

tlylt opened this issue Feb 17, 2023 · 3 comments

Comments

@tlylt
Copy link

tlylt commented Feb 17, 2023

Hi there!

I'm trying out the example given in the README, with slight modifications to use the latest actions/checkout and actions/setup-node

name: "Danger TS"

on: pull_request

permissions:
  actions: write
  checks: write
  contents: write
  issues: write
  pull-requests: write
  statuses: write

jobs:
  danger:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - name: "Use npx to run the dangerfile"
        run: "npx danger-ts"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The result is a CI run failure:

Run npx danger-ts
npm WARN exec The following package was not found and will be installed: [email protected]
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '/home/runner/.npm/_npx/d1[7](https://github.com/tlylt/danger-demo/actions/runs/4201699300/jobs/7288964524#step:4:8)13d9723[8](https://github.com/tlylt/danger-demo/actions/runs/4201699300/jobs/7288964524#step:4:9)8ceec/node_modules/lib/node_modules/danger-ts/node_modules/danger/distribution/commands/danger-runner.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:[9](https://github.com/tlylt/danger-demo/actions/runs/4201699300/jobs/7288964524#step:4:10)95:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:[12](https://github.com/tlylt/danger-demo/actions/runs/4201699300/jobs/7288964524#step:4:13))
    at node:internal/main/run_main_module:22:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
@orta
Copy link
Member

orta commented Feb 17, 2023

Weird, it worked three years ago - maybe see what is being installed in npx via a verbose/debug flag?

@tlylt
Copy link
Author

tlylt commented Feb 18, 2023

Thanks @orta for following up! I just tried adding the --verbose flag, that gave more details from the danger execution:

npx danger-ts --verbose

Node.js v18.14.1

Failing the build, there is 1 fail.
Request failed [403]: https://api.github.com/user
Response: {
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/reference/users#get-the-authenticated-user"
}
Request failed [403]: https://api.github.com/user
Response: {
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/reference/users#get-the-authenticated-user"
}
Feedback: https://github.com/tlylt/danger-demo/pull/2#issuecomment-1435437361
Danger: ⅹ Failing the build, there is 1 fail.
## Failures
`node` failed.
## Markdowns
### Log


```sh

This suggests that it could be due to the node version. I found out that v18 and v16 result in the error above. However, v14 still works.

Not too sure what it takes to make it compatible with the latest versions though. Thanks.

@orta
Copy link
Member

orta commented Feb 18, 2023

Probably that 16 + 18 use different versions of npm and maybe it has different rules (I don't use npm anywhere) maybe there's a way to use yarn to trigger danger ts instead via yarn dlx which is consistent across builds

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

2 participants