apigee-samples
apigee-samples copied to clipboard
npm run preinstall in authorize-idp
Description
Running npm install or npm run preinstall leads to a permissions error.
To Reproduce
-
Run
npm installor
npm run preinstall -
See error
$ npm run preinstall > [email protected] preinstall > npm list [email protected] -g || npm install [email protected] -g /usr/local/lib └── (empty) npm ERR! code EACCES npm ERR! syscall symlink npm ERR! path ../lib/node_modules/pem-jwk/bin/pem-jwk.js npm ERR! dest /usr/local/bin/pem-jwk npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/pem-jwk/bin/pem-jwk.js' -> '/usr/local/bin/pem-jwk' npm ERR! [Error: EACCES: permission denied, symlink '../lib/node_modules/pem-jwk/bin/pem-jwk.js' -> '/usr/local/bin/pem-jwk'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'symlink', npm ERR! path: '../lib/node_modules/pem-jwk/bin/pem-jwk.js', npm ERR! dest: '/usr/local/bin/pem-jwk' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: /Users/dchiesa/.npm/_logs/2024-03-02T01_44_13_832Z-debug-0.log
Additional Context
I ran this on MacOS with
$ npm --version
9.8.1
Expected behavior
install or preinstall should work. In fact there is no need to require global installation of the pem-jwk module. The script that uses the module (deploy-authorize-idp-access-tokens.sh ) can easily reference it from node_modules.
have to run as sudo
sudo npm install as the preinstall script is installing the module globally