I’m encountering a ‘permission denied’ error while trying to install CoffeeScript on my Mac. I currently have Node.js version 0.6.7 and npm version 1.1.0-beta-10.
When I run the command to install CoffeeScript globally, I receive the following error message:
Had this exact issue last year setting up a dev environment. Your Node was probably installed with admin privileges, so npm tries installing global packages where your regular user can’t write. Changing ownership works but breaks things when you update Node later. I fixed it permanently by reinstalling Node with Homebrew instead of the official installer. Remove your current installation, then run brew install node. Homebrew sets up Node with proper user permissions from the start - global npm installs just work without sudo or ownership changes. Way more reliable long-term.
This happens because npm’s trying to write to system directories that need admin permissions. Don’t change ownership of system folders - use a Node version manager like nvm instead. It installs everything in your user directory. Install nvm, then reinstall node through it. No more permission issues since packages go to ~/.nvm instead of /usr/local. Or you can tell npm to use a different directory you own. Run npm config set prefix ~/.npm-global and add ~/.npm-global/bin to your PATH. Way cleaner than messing with system permissions and stops future headaches.
same here, i had that same problem! just use sudo chown -R $(whoami) /usr/local/lib/node_modules to change ownership, then try installing again without sudo. that worked for me on osx lion!
Npm permission issues are a pain. Skip the hassle entirely.
I use Latenode to build a simple automation workflow for CoffeeScript compilation. Set up a flow that watches your source files and auto-compiles them - no local installations needed.
I’ve done this for several client projects where we needed consistent builds across different dev machines. The workflow grabs your CoffeeScript files, compiles them, and drops the JavaScript wherever you want it.
No permission headaches, no version conflicts between teammates, and it works identically on Mac, Windows, or Linux. You can even chain in minification or deployment steps.