I encountered an issue while attempting to install the leaflet library on npm. Despite trying various troubleshooting steps such as reinstalling npm, clearing cache, removing node_modules, and retrying the installation, the error persists.
nasersobhan@Nasers-MacBook-Pro Library % npm i leaflet
npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path /Users/nasersobhan/.npm/_cacache/content-v2/sha512/20/8f
npm ERR! errno EEXIST
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/leaflet: EACCES: permission denied, mkdir '/Users/nasersobhan/.npm/_cacache/content-v2/sha512/20/8f'
npm ERR! File exists: /Users/nasersobhan/.npm/_cacache/content-v2/sha512/20/8f
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! Log files were not written due to an error writing to the directory: /Users/nasersobhan/.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
My attempt to install leaflet resulted in an unexpected error.