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

Cannot read properties of undefined (reading 'filename') #419

Closed
pbrisbin opened this issue Aug 27, 2024 · 7 comments · Fixed by #421
Closed

Cannot read properties of undefined (reading 'filename') #419

pbrisbin opened this issue Aug 27, 2024 · 7 comments · Fixed by #421

Comments

@pbrisbin
Copy link

I'm getting the error in the title attempting to run npm-groovy-lint --version.

You can reproduce using a node20 docker image with the following:

cat >package.json <<'EOM'
{
  "name": "repro",
  "version": "0.0.0",
  "dependencies": {
    "npm-groovy-lint": "15.0.0"
  }
}
EOM

cat >Dockerfile <<'EOM'
FROM node:20-slim
RUN mkdir -p /app
WORKDIR /app
COPY package.json .
RUN npm install
EOM

docker build --tag repro .
docker run --rm repro ./node_modules/.bin/npm-groovy-lint --version

I get:

Unexpected error: Cannot read properties of undefined (reading 'filename')
TypeError: Cannot read properties of undefined (reading 'filename')
    at JavaCaller.manageJavaInstall (/app/node_modules/java-caller/lib/java-caller.js:278:58)
    at async JavaCaller.run (/app/node_modules/java-caller/lib/java-caller.js:95:13)
    at async CodeNarcCaller.startCodeNarcServer (file:///app/node_modules/npm-groovy-lint/lib/codenarc-caller.js:283:28)
    at async CodeNarcCaller.callCodeNarcServer (file:///app/node_modules/npm-groovy-lint/lib/codenarc-caller.js:94:22)
    at async NpmGroovyLint.callCodeNarc (file:///app/node_modules/npm-groovy-lint/lib/groovy-lint.js:275:32)
    at async NpmGroovyLint.run (file:///app/node_modules/npm-groovy-lint/lib/groovy-lint.js:67:13)
    at async NpmGroovyLint.preProcess (file:///app/node_modules/npm-groovy-lint/lib/groovy-lint.js:223:43)
    at async NpmGroovyLint.run (file:///app/node_modules/npm-groovy-lint/lib/groovy-lint.js:65:27)
    at async file:///app/node_modules/npm-groovy-lint/lib/index.js:12:9

Omitting --version produces the same error. But --help seems to work.

Everything was working fine with v14.6.


For context, I maintain Restyled, which wraps this project as a Restyler. Our CI is failing on the update to v15.

@nvuillam
Copy link
Owner

@pbrisbin thanks for reporting, i'll have a look tonight :)

@nvuillam
Copy link
Owner

nvuillam commented Aug 29, 2024

I succeeded to reproduce the issue on linux (MegaLinter build ^^)

I'll do what i can to fix, as it's probably in node-java-caller package ^^

@pbrisbin
Copy link
Author

Thanks!

@nvuillam
Copy link
Owner

nvuillam commented Sep 1, 2024

@pbrisbin working well now ? :)

@pbrisbin
Copy link
Author

pbrisbin commented Sep 3, 2024

Yup, v15.0.2 passed CI and we updated our Restyler to it.

@nvuillam
Copy link
Owner

nvuillam commented Sep 3, 2024

@pbrisbin thanks for your feedback :)

it seems there is still an issue with latest version, maybe make some tests before using it ^^

#422

@pbrisbin
Copy link
Author

pbrisbin commented Sep 3, 2024

Ah that's too bad. We do have some tests, that passed. So the issue must be limited in scope.

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

Successfully merging a pull request may close this issue.

2 participants