Getting started with the AngularJS tutorial on Windows – issues

Here’s a quick summary of specific issues and workarounds I’ve run into so far:

  • Running ‘npm install’ and get: “Error: ENOENT, stat ‘C:\Users\[user id]\AppData\Roaming\npm”

This appears to be something removed in the node.js Windows installer. If you create the npm dir in the location above, this fixes this issue, and/or running the node.js prompt with admin privs in Windows. Covered here.

  • Error: ENOENT, no such file or directory 'c:\[some path]\package.json'

The Angular.JS tutorial steps don’t mention that you need to cd into the cloned angular-phonecat dir after you’ve grabbed it from github. Maybe this would be obvious if you’re already familiar with node.js and npm, but cd’ing into the cloned tutorial dir fixes this issue for me. Similar to this issue.

  • ‘npm start’ throws errors re binding to 0.0.0.0 and port 8000

I’m not sure if this was because something was already running on port 8000 on my Windows box, but similar to the comments on the logged comments here, if you follow the steps to edit the package.json file, you can change the bind address and/or port before starting the server. Changing from 8000 to 8080 seemed to fix it for me.

Mounting USB drives on an Ubuntu VirtualBox guest on Mac OS X host

If you’ve come across this already then this might be obvious, but in order to mount a USB external drive on an Ubuntu VirtualBox guest running on a Mac OS X host, you need to unmount the drive in Mac’s Finder first. Then using either click the USB icon in the status bar in your Ubuntu guest and you’ll see the drive un-greyed out (when it’s mounted on the Mac it appears greyed out and you can’t select it) – click it and it will mount automatically. Or you can do the same thing from the VirtualBox menu, Devices/USB.

Eclipse error: Access restriction: The type ‘xyz’ is not API

Eclipse has some pretty bizarre error messages that really don’t tell you exactly what the error is or how to fix it. This weekend I saw this one for example:

Access restriction: The type 'xyz' is not API (restriction on required library ...)

A quick Google told me what this actually means is that I have a line of code using a JDK API that is not in the currently selected runtime for the current project, but does exist in other available runtimes.

For example, when setting up a project with a Maven pom.xml, if you don’t explicitly specify what JVM version you want for the project, you get Java 5 by default.

There’s a couple of different ways to change the JVM version using Maven, but the approach I prefer is by adding properties (because it’s more concise than configuring the Maven compiler plugin):

<properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
</properties>

Alternatively if you’re not using Maven, just change the JRE System Library in the project settings on the Java Build Path/Libraries tab (remove the one that’s currently there and add the version that does have the APIs that you’re using, most likely a later version).