I'm trying to install caluse code but get the following error, why?(base)…
- User
I'm trying to install caluse code but get the following error, why?(base) lc@lcs-MacBook-Pro publications % npm install -g @anthropic-ai/claude-code npm error code EACCES npm error syscall mkdir npm error path /usr/local/lib/node_modules/@anthropic-ai npm error errno -13 npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@anthropic-ai' npm error at async mkdir (node:internal/fs/promises:852:10) npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:624:20 npm error at async Promise.allSettled (index 0) npm error at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11) npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5) npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5) npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9) npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5) { npm error errno: -13, npm error code: 'EACCES', npm error syscall: 'mkdir', npm error path: '/usr/local/lib/node_modules/@anthropic-ai' npm error } npm error npm error The operation was rejected by your operating system. npm error It is likely you do not have the permissions to access this file as the current user npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm error A complete log of this run can be found in: /Users/lc/.npm/_logs/2025-06-22T20_40_37_159Z-debug-0.log
Assistant
This is a permissions error that occurs when npm tries to install packages globally but doesn't have write access to the system directories. The error EACCES: permission denied indicates that npm can't create the directory /usr/local/lib/node_modules/@anthropic-ai because your user doesn't have the necessary permissions. Here are a few solutions to fix this: Option 1: Use sudo (Quick fix) bashsudo npm install -g @anthropic-ai/claude-code Option 2: Fix npm permissions (Recommended) This is the better long-term solution. Change npm's default directory to avoid permission issues:
Create a directory for global installations:
bashmkdir ~/.npm-global
Configure npm to use the new directory:
bashnpm config set prefix '~/.npm-global'
Add the new directory to your PATH by adding this line to your ~/.bash_profile, ~/.zshrc, or ~/.bashrc:
bashexport PATH=~/.npm-global/bin:$PATH
Reload your shell configuration:
bashsource ~/.zshrc # or ~/.bash_profile depending on your shell
Now install Claude Code:
bashnpm install -g @anthropic-ai/claude-code Option 3: Use a Node version manager Consider using a Node version manager like nvm which handles permissions better: bash# Install nvm first, then: nvm install node npm install -g @anthropic-ai/claude-code The second option is generally recommended as it avoids using sudo with npm, which can cause other permission issues down the line.
- User
Now I've got that. (base) lc@lcs-MacBook-Pro publications % npm install -g @anthropic-ai/claude-code added 3 packages in 7s2 packages are looking for fundingWhat is funding?
Assistant
The "packages are looking for funding" message is just informational - it means that some of the dependencies (packages) that Claude Code relies on have developers who are seeking financial support for their open-source work. Many open-source JavaScript packages include a funding field in their package.json file where maintainers can list ways people can support their work - through platforms like GitHub Sponsors, Open Collective, Patreon, or direct donations. This message doesn't affect the functionality of Claude Code at all - it's just npm's way of highlighting that some package authors would appreciate financial support for maintaining their projects. You can safely ignore it. If you're curious about which packages are seeking funding, you can run: bashnpm fund This will show you the funding information for packages that have it configured. Now that Claude Code is installed, you should be able to use it! Try running: bashclaude-code --help to see the available commands and get started with delegating coding tasks to Claude from your terminal.
- User
So seems like the first workedm tx (used answer two)
Assistant
Great! I'm glad option 2 worked for you - that's the best approach since it sets up proper npm permissions for the long term. Now you won't run into those permission issues when installing other global packages in the future. You should be all set to start using Claude Code now. You can begin by running claude-code --help to see what's available, or just jump right in with your coding tasks. Let me know if you need any help getting started with Claude Code or run into any other issues!