GoogleCloudPlatform / GoogleCloudPlatform/apigee-samples

npm run preinstall in authorize-idp

Open
#140 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
140
Forks
92
PR merge metrics
No merged PRs in 30d

Description

## Description

Running `npm install` or `npm run preinstall` leads to a permissions error.

## To Reproduce

1. Run
```
npm install
```
or
```
npm run preinstall
```

2. See error
```
$ npm run preinstall

> oauth-client-credentials@1.0.0 preinstall
> npm list pem-jwk@2.0.0 -g || npm install pem-jwk@2.0.0 -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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.