Missing write access to /opt/nvm/versions/node/v8.15.1/lib/node_modules

A Error when i installing fly.io

Logs

$ npm install -g @fly/fly
npm WARN checkPermissions Missing write access to /opt/nvm/versions/node/v8.15.1/lib/node_modules
npm ERR! path /opt/nvm/versions/node/v8.15.1/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/opt/nvm/versions/node/v8.15.1/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/opt/nvm/versions/node/v8.15.1/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/opt/nvm/versions/node/v8.15.1/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/nvm/versions/node/v8.15.1/lib/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache/8.15.1/_logs/2019-12-19T17_18_00_818Z-debug.log

How to fix this i tried a lot to fix but its not fixing

you cannot use the flag -g, instead run

pnpm add @fly/fly

To add onto @J-Tech-Foundation’s answer: also run enable-pnpm in your projects console else PNPM won’t work correctly (or at all).