ThreeNodes.js / NodeJS / CoffeeScript - Error During Build to Static JS
Problem
I ran server.js with node and everything worked perfectly. It's when I try to run the build script to create a compiled static version. I should also mention that it does output most of the files, but then throws an Error mid-way.
I ran:
node server.js build
It seemed to work fine until it got to "Starting to Optimize the javascripts..."
Error Output:
/root/threenodes/ThreeNodes.js/node_modules/requirejs/bin/r.js:14153
throw new Error(errorMsg);
^
Error: TypeError: Object function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
var args = aps.call(arguments, 0), lastArg;
if (enableBuildCallback &&
isFunction((lastArg = args[args.length - 1]))) {
lastArg.__requireJsBuild = true;
}
args.push(relMap);
return func.apply(null, args);
} has no method 'nameToUrl'
In module tree:
threenodes/App
order
at Object.load (eval at (/root/threenodes/ThreeNodes.js/node_modules/requirejs/bin/r.js:13687:38))
Solution
I've just committed a fix to threenodes.js which should resolve your issue. It was caused by the fact that requirejs has been updated and the !order plugin is now deprecated. So the fix was simply to define a more precise version of requirejs in package.json.
https://github.com/idflood/ThreeNodes.js/commit/440757aa579ae3d35354e960a2bd5745bdee6847
To fix it:
- git pull origin master
- npm install -d
- node server.js build
As a side note, the dev branch use the new version of requirejs. It's still not merged on master because I've started to work on "node grouping" but it is not finished yet. Apart from this all other functionality should work the same way as on the master branch. So if you plan to develop something on top of threenodes I would recommend to use the dev branch ; ]
Discussion
View additional discussion.