Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No such file or directory" running TypeScript on Ubuntu 13.10

I seem to have broken my TypeScript installation on Ubuntu 13.10 in the process of trying to build it from sources. I've given up on that and now just want to return to a working binary installation.

I removed NodeJS with --purge and reinstalled via

sudo apt-get install nodejs

and ensured that 'node' is indeed pointing to NodeJS (and not the Ubuntu package "node", which I uninstalled). Typing node at the command-line drops me into the NodeJS prompt so that looks fine.

Then I reinstalled npm and then the TypeScript binary via

sudo npm -g install [email protected]

which resulted in

npm http GET https://registry.npmjs.org/typescript/0.9.1-1
npm http 304 https://registry.npmjs.org/typescript/0.9.1-1
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
[email protected] /usr/local/lib/node_modules/typescript

I checked that which tsc points to /usr/local/bin/tsc. The contents of this file is:

#!/usr/bin/env node
require('./tsc.js')

The directory /usr/local/lib/node_modules/typescript/bin/ contains

drwxr-xr-x  3 nobody rolyp    4096 Oct 24 22:55 ./
drwxr-xr-x  3 nobody rolyp    4096 Oct 24 22:55 ../
-rw-r--r--  1 nobody rolyp  323793 Aug 21 17:17 lib.d.ts
drwxr-xr-x 16 nobody rolyp    4096 Oct 24 22:55 resources/
-rwxr-xr-x  1 nobody rolyp      42 Aug 21 17:17 tsc*
-rw-r--r--  1 nobody rolyp 2565152 Aug 21 17:17 tsc.js
-rw-r--r--  1 nobody rolyp 2509628 Aug 21 17:17 typescript.js

Finally, if I change to the directory manually, type node, and then enter require('./tsc.js') at the NodeJS prompt, then tsc runs successfully.

But if I type tsc at the command-line, I just get the obscure message

`: No such file or directory`

Note that I'm not getting the error env: node: No such file or directory, which I struggled with when I first installed TypeScript on Ubuntu, because of the node/ NodeJS clash.

Can anyone tell me what I need to do to run tsc from the command-line via node, given that I can launch it manually as described above?

like image 387
Roly Avatar asked Nov 28 '22 21:11

Roly


2 Answers

I install node from package manager as nodejs. To solve issue : “No such file or directory” running TypeScript, I use digitalmediums sugestion from https://github.com/joyent/node/issues/3911: just create symlink:

ln -s /usr/bin/nodejs /usr/bin/node
like image 128
Jan Pavtel Avatar answered Nov 30 '22 10:11

Jan Pavtel


sudo gedit /usr/local/lib/node_modules/typescript/bin/tsc

updated the initial Content

#!/usr/bin/env node
require('./tsc.js')

TO

#!/usr/bin/env nodejs
require('./tsc.js')
like image 41
Bogdan Avatar answered Nov 30 '22 11:11

Bogdan