samples/amd does not compile

Topics: General
Jan 9, 2013 at 4:59 AM

amd sample does not compile. how to fix this?

sto@hive:~/workspace/d3/samples/amd$ tsc --module amd app.ts


node.js:201        throw e; // process.nextTick error, or 'error' event on first tick              ^TypeError: Object #<Object> has no method 'existsSync'    at Object.findFile (/usr/local/lib/node_modules/typescript/bin/tsc.js:21182:28)    at CodeResolver.resolveCode (/usr/local/lib/node_modules/typescript/bin/tsc.js:19700:43)    at CodeResolver.resolveCode (/usr/local/lib/node_modules/typescript/bin/tsc.js:19743:30)    at CommandLineHost.resolveCompilationEnvironment (/usr/local/lib/node_modules/typescript/bin/tsc.js:21492:22)    at BatchCompiler.resolve (/usr/local/lib/node_modules/typescript/bin/tsc.js:21508:40)    at BatchCompiler.batchCompile (/usr/local/lib/node_modules/typescript/bin/tsc.js:21854:76)    at Object.<anonymous> (/usr/local/lib/node_modules/typescript/bin/tsc.js:21891:7)    at Module._compile (module.js:441:26)    at Object..js (module.js:459:10)    at Module.load (module.js:348:32)

Coordinator
Jan 9, 2013 at 5:30 PM

Do you have a small example that shows this issue?  Without seeing the code, it's hard to understand the issue. 

By the way, another good place to get help with the ins and outs of working with modules is on the StackOverflow Q&A for TypeScript.

Jan 9, 2013 at 5:39 PM

the src code is the amd sample at

http://typescript.codeplex.com/SourceControl/changeset/view/a3f0ee5ab85d#samples/amd/app.ts

http://typescript.codeplex.com/SourceControl/changeset/view/a3f0ee5ab85d#samples/amd/greeter.ts

I'm using the compiler installed via npm

npm install typescript

which seems to be 0.8.1-1

thanks for replying!

Jan 9, 2013 at 6:48 PM

it seems this problem happens only on linux. I borrowed a co-workers windows 7 machine and it compiles fine. Please don't make this tool windows specific. It will hinder TypeScript's adoption. I am more comfortable working on a Linux environment. I'd hate to boot into windows just to run tsc 

Jan 10, 2013 at 4:53 PM
Edited Jan 10, 2013 at 4:55 PM

the problem happens only on Linux. There's a bug in tsc.js:21069 with require('fs'). When this module loads existsSync does not exist

I can't seem to find a fs.ts or an fs.js  where is the source to the "fs" module?

 

thanks,

Sonny

Jan 10, 2013 at 5:01 PM

the fs module is from nodeJS. turns out ubuntu 12.04 has an old version of node. after upgrading to the latest version the amd example compiled

in case anyone runs into this problem. Here's how to install the latest nodeJS on ubuntu

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs