Allow disabling SSL and hash checks for plugin linking.


Question

I encounter an error when trying to link a plugin to the CLI in a corporate network environment:

PS C:\Sandbox\SFDX-Data-Move-Utility> sfdx plugins:link
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.

(node:5912) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

error An unexpected error occurred: "SSL Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY".

sfdx-cli: linking plugin sfdmu... !

Error: yarn --non-interactive --mutex=file:C:\Sandbox\SFDX-Data-Move-Utility\yarn.lock

--preferred-cache-folder=C:\Users\1219611\AppData\Local\sfdx\yarn --check-files exited with code 1

PS C:\Sandbox\SFDX-Data-Move-Utility>

I would like to bypass SSL errors due to ZScaler on my corporate network by disabling the "--check-files" option of yarn.


Answer

We cannot modify the sfdx plugin:link command directly to add extended options. A possible workaround is:

$ npm config set strict-ssl=false
$ npm config set registry http://registry.npmjs.org/
$ set NODE_TLS_REJECT_UNAUTHORIZED=0

Then, remove the yarn.lock file.


For more details, see this discussion on Stack Overflow.

Last updated on 20th Apr 2024