There’s nothing quite like grappling with the installation of a development environment, there is no greater joy than getting bogged down before you’ve even written a single line of code. Today I installed NativeScript on Mac (El Capitain) and these are some of the problems I encountered.
The instructions on the NativeScript Advanced Setup for OSX seem straight forward enough, so lets give it a go:
brew install homebrew/versions/node4-lts
And before IĀ even get off the starting blocks I’m in error country:
Error: undefined method `desc' for Node4Lts:Class
OK, maybe my brew is out of date since I don’t really use it, so I’ll try this:
brew update
Which resulted in this:
warning: unable to unlink .yardopts: Permission denied warning: unable to unlink CONTRIBUTING.md: Permission denied warning: unable to unlink SUPPORTERS.md: Permission denied fatal: cannot create directory at '.github': Permission denied Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
Which means maybe I have an permissions problem, and you generally don’t use sudo with brew so I do this:
sudo chown -R $(whoami):admin /usr/local cd /usr/local && git fetch && git reset --hard origin/master
And finally I try this again:
brew update
Success!
So now I can finally install Node (I’m not cool enough to already have it installed):
brew install homebrew/versions/node4-lts
Success! Things are going quite well and the rest of the steps go smoothly (I didn’t bother with the Android steps) except for the thing I actually need:
npm i -g nativescript
More permission errors:
npm ERR! Error: EACCES, mkdir '~/.npm/through2/0.2.3'
So, lets chown everything in my home npm directory:
sudo chown -R $(whoami):admin ~/.npm
And try it again:
npm i -g nativescript
Success! Now I can start dealing with real problems.