Yarn has introduced a new approach to install dependencies: plug’n’play, it will be the default option for Yarn 2.
PNP means that Yarn will not copy dependencies to node_modules
, it will create .pnp.js
file and inject hooks into NodeJS resolution mechanisms.
Currently I Sonar Scanner seems to be unaware of that and fails with error:
ERROR: Cannot find module 'typescript'
Require stack:
- /builds/web-modules/web-modules-core/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/tsconfig.js
- /builds/web-modules/web-modules-core/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/server.js
- /builds/web-modules/web-modules-core/.scannerwork/.sonartmp/eslint-bridge-bundle/package/bin/server
ERROR: TypeScript dependency was not found and it is required for analysis.
ERROR: Install TypeScript in the project directory or use NODE_PATH env. variable to set TypeScript location, if it's located outside of project directory.
INFO: Sensor TypeScript analysis [javascript] (done) | time=207ms
ERROR: Missing TypeScript dependency
org.sonar.plugins.javascript.eslint.MissingTypeScriptException: Missing TypeScript dependency
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.loadTsConfig(EslintBridgeServerImpl.java:270)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1621)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)