Hi We're having some issues on our build server w...
# javascript
m
Hi We're having some issues on our build server when attempting to build a branch using the new js-plugin. During the build, some third party node-module tries to log using node. However, this results in a permission error.
Copy code
> Task :kotlinNpmInstall
error /var/jenkins_home/Build_pluginupgrades/build/js/node_modules/jss: Command failed.
Exit code: 126
Command: node -e "console.log('\u001b[35m\u001b[1mLove JSS? You can now support us on open collective:\u001b[22m\u001b[39m\n > \u001b[34m<https://opencollective.com/jss/donate>\u001b[0m')"
Arguments: 
Directory: /var/jenkins_home/Build_pluginupgrades/build/js/node_modules/jss
Output:
/bin/sh: 1: node: Permission denied

> Task :kotlinNpmInstall FAILED
When using the plugin, where is node/yarn installed?
i
I think problem can be with node We install node in gradle home directory, but it is not written in
PATH
, and when 3rd parti modules are installed, thay run some postinstall scripts which tries to run
node
exec, so when you run it on Jenkins, node can have not appropriate permissions. I think, WA can be to install Node on your build server
n
you using Jenkins?
it might just need a chmod
chmod o+x
126 is an non executable error
a ton of install scripts don't see the +x on anything
m
Node is able to install numerous modules, so the Node used by the Kotlin plugin doesn't seem to have permission issues. It's when one of the plugins being installed calls Node as part of the installation that the permission error occurs. Apparently, this is some other Node instance. I will continue investigating.
i
It seems that it is
node
inside Jenkins, because command
node …
likely uses node from
PATH
, but we don’t write our node to
PATH
m
I fixed the problem by adding "unsafe-perm true" to my .yarnrc file (https://docs.npmjs.com/misc/config#unsafe-perm). Our build server is running as root, so the installed node was not accessible by "normal" users. One of the modules had the following in package.json:
Copy code
"postinstall": "node -e \"console.log('\\u001b[35m\\u001b[1mLove JSS? You can now support us on open collective:\\u001b[22m\\u001b[39m\\n > \\u001b[34m<https://opencollective.com/jss/donate>\\u001b[0m')\""
For security reasons, this is run as non-root, which results in the permission error. Just adding the configuration did initially not solve my problem, I had to delete my Jenkins workspace and build again.