Recently switched to using the kotlin plugin’s web...
# javascript
r
Recently switched to using the kotlin plugin’s webpack rather than my own custom configuration, and I’ve been running into this issue in about 50% of my builds: During the kotlinNpmInstall task, sometimes when a library runs its postinstall scripts, they return errors along the lines of
Copy code
Exit code: 127
Command: node scripts/build-browser-scripts
Arguments: 
Directory: /home/circleci/project/build/js/node_modules/wd
Output:
/bin/sh: 1: node: not found
...
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
>                 Process 'Resolving NPM dependencies using yarn' returns 127
Fun right? It doesn’t always happen on the same postinstall script. I’m pretty sure node is installed on the docker image (though it shouldn’t be using that version - it should use the version the kotlin plugin downloads). It doesn’t seem to be affected by running kotlinNodeJsSetup in a previous gradle run. Any clues would be useful… this is blocking me from fully utilizing the power of the plugin. 😰
using kotlin versions 1.3.71, for those curious
I haven’t really figured out the underlying problem, but it does seem to be affected by certain npm dependencies… but not obviously the ones that sometimes cause the error.
i
Can you attach a link to your project?
r
Yeah I’ll set up a branch that illustrates the problem
Example build (rerunning this will produce the problem about half the time): https://circleci.com/gh/robertfmurdock/Coupling/5010 Code for that branch: https://github.com/robertfmurdock/Coupling/tree/KotlinNpmInstallIssue Note that in the :client and the :server projects the npm dependencies are getting pulled in from the package.json file (so I can use ncu to automate version updates), and the problem no longer shows up (at present) when I remove those dependencies from the :server project (which isn’t currently using them because its still on a manually configured webpack build process).
Reintroducing npm dependencies 1 at a time, it seems almost like you hit a certain number of npm dependencies and the error starts popping up
b
cc @Ilya Goncharov [JB]
i
It seems, that kotlin plugin install its own node version, but plugin doesn’t add it to PATH (because it is invasive) But when post install scripts are run, they try to find node command in bash, and seems that node is not installed in path in CI environment You can try to use Docker image with preinstalled Node.JS And feel free to create issue with your use case, maybe we need to register our installed node in system somehow https://youtrack.jetbrains.com/issues/KT
r
weirdly enough, I think that image actually does have a version of node installed! At least I thought I did when I checked it last. I’ll look again.
Thanks for taking a look @bashor @ilya.gorbunov. The it only sometimes happens aspect of this is the most befuddling.