Closed Lubytes closed 4 years ago
The NPM package typescript
does'nt contain any binary that goes by the name typescript
. Therefore, I assume this is not an error.
However, I am not sure why the module/package typescript
seems to be missing. Maybe the NODE_PATH
variable cannot be resolved correctly. But that's only a guess right now.
Can you run the resource with __debug: true
in it's source configuration? Maybe the full and verbose log output can provide better insights into what's going on.
Unfortunately __debug: true
did not yield any useful output corresponding to this issue.
I launched a container with my project in it and tried a couple different things. Here's what I found:
By doing npm link typescript
inside my project in the container, it created a node_modules folder with a linked version of the global typescript module inside my project. This fixed my Error: Cannot find module 'typescript'
issue. But I still have a java.lang.IllegalStateException: Error parsing the report '/root/my-project/.scannerwork/sonarts-bundle/node_module/node_modules/path-parse/test.js'
at the end (I had this before). I'm not sure if this is related or if adding an exception to node_module/* will fix it.
Anyway, this shows that the sonar-scanner is having a hard time picking up the global typescript module when evaluating. Unfortunately linking isn't an option when we're running this right out of a container, so we still need a global fix.
I added ENV NODE_PATH /usr/local/lib/node_modules
to the docker image and that seemed to do the trick for the typescript module issue. I'm still faced with the IllegalStateException but I'm going to try some stuff on my own and open a new ticket if necessary.
Even with the
RUN npm install -g typescript@${TYPESCRIPT_VERSION}
in the latest version I'm still getting the following error:Doing
which typescript
inside the docker image also shows it can't find typescript. There's only tsc and tsserver.