npm is installed and is actively being used from IntelliJ IDEA 15
My goal is to generate typings for my TypeScript source code in IntelliJ, but I want to learn using the Windows command line, so I can explicitly specify the command line options to tinker to understand what each option does. I am confused by the various tidbits related to setting this up and using it that I've found by Googling... I'm sure that I'm missing something very basic that those who blog or answer questions assume as common knowledge...
Here's what I've attempted and what I'm seeing...
Step 1: install typescript:
npm install -g typescript
This results in the following file/directory structure being installed on my system:
C:Users{my user id}AppDataRoaming
pm
ode_modulesypescript
|---bin
| |--- tsc
| |--- tscserver
|---lib
| |--- lib.core.d.ts
| |--- ...
| |--- typescriptServices.js
|--- .npmignore
|--- ...
|--- ThirdPartyNoticeText.txt
Step 2: naively try to run tsc
directly from the Windows command line:
The examples that I've found by Googling take the form:
Compile a single file:
tsc app.ts
above example is from http://www.primordialcode.com/blog/post/typescript-command-line-compiler
This does not work as shown because:
The install directory of tsc
is not on the Windows Path
C:Users{my user id}AppDataRoaming
pm
ode_modulesypescriptin
, obviously this is easily remedied or worked around by changing the Window PATH environmental variable and/or fully qualifying the path to the tsc
file when entering the command to execute.
More significantly the tsc
file is not a Windows executable... the #!
Unix script (shebang) being a dead giveaway.
Inspecting the tsc
file:
#!/usr/bin/env node
require('../lib/tsc.js')
Step 3: try to run tsc
from the node command prompt:
C:>
node
>
tsc
ReferenceError: tsc is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
^C
OK... let's specify the full path to the tsc
script:
C:>
node
>
C:Users{my user id}AppDataRoaming
pm
ode_modulesypescriptinsc
...
literally the only output is ...
when specifying the full path to the tsc
script... I guess that it wants parameters... but hitting the tab
key reveals a list of what seem to be node commands (not tsc
commands)... so I've no idea what's going on here...
Now I'm stuck
What environment do I need to install/configure/use to invoke tsc
(as illustrated by: http://www.primordialcode.com/blog/post/typescript-command-line-compiler)?
and/or
Is there a tutorial or site that would help me go from a clean Windows system to being able to use the TypeScript compiler from the command line to generate typings for my TypeScript source files?
See Question&Answers more detail:
os