Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

add a temporary path

63 views
Skip to first unread message

Janis Rough

unread,
Jan 15, 2017, 6:19:49 PM1/15/17
to
Please help I'm trying to use typescript. It is installed see the installation below no errors. The problem is the tsc editor thingy does not work. command tsc -h says it is not found.
sh-3.2# npm install -g typescript
/var/root/.npm-packages/bin/tsc -> /var/root/.npm-packages/lib/node_modules/typescript/bin/tsc
/var/root/.npm-packages/bin/tsserver -> /var/root/.npm-packages/lib/node_modules/typescript/bin/tsserver
/var/root/.npm-packages/lib


h-3.2# tsc -h
sh: tsc: command not found

So my guess is to add it to the Path. I added to the temporary path and it still says not found. Any ideas?

aniss-MBP:~ jrough$ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-packages/bin/tsc
Janiss-MBP:~ jrough$ tsc -h
-bash: tsc: command not found
└── types...@2.1.5

thanks,

Ed Morton

unread,
Jan 15, 2017, 8:28:34 PM1/15/17
to
What does

/var/root/.npm-packages/bin/tsc -h

output?

What does:

ls -l /var/root/.npm-packages/bin/tsc

output?

How about

ls /var/root/.npm-packages/bin

and so on....

Ed.

Barry Margolin

unread,
Jan 16, 2017, 11:00:59 AM1/16/17
to
In article <0b4c6b01-227c-4abe...@googlegroups.com>,
The entries in PATH should be directories, you don't put the filename
itself in there. So you should just add /var/root/.npm-packages/bin to
PATH.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Helmut Waitzmann

unread,
Jan 16, 2017, 11:02:39 AM1/16/17
to
Janis Rough <janis...@gmail.com>:
> Please help I'm trying to use typescript. It is installed see
> the installation below no errors. The problem is the tsc editor
> thingy does not work. command tsc -h says it is not found.
> sh-3.2# npm install -g typescript
> /var/root/.npm-packages/bin/tsc -> /var/root/.npm-packages/lib/node_modules/typescript/bin/tsc
> /var/root/.npm-packages/bin/tsserver -> /var/root/.npm-packages/lib/node_modules/typescript/bin/tsserver
> /var/root/.npm-packages/lib
>
>
> h-3.2# tsc -h
> sh: tsc: command not found
>
> So my guess is to add it to the Path. I added to the temporary
> path and it still says not found. Any ideas?
>
> aniss-MBP:~ jrough$ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-packages/bin/tsc
> Janiss-MBP:~ jrough$ tsc -h
> -bash: tsc: command not found
> └── types...@2.1.5

Possibly you added the program file name to the PATH rather than
its directory? To investigate this, you could run

the command

ls -Lld -- \
/var/root/.npm-packages/bin/tsc \
/var/root/.npm-packages/bin/tsc/tsc

What does it show?

Will

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-packages/bin/

work?

Janis Rough

unread,
Jan 16, 2017, 12:03:02 PM1/16/17
to
okay I tried PATH=/usr/bin:/bin:/usr/sbin:/var/root/.npm-packages/bin
I closed the terminal and tried
Janiss-MBP:~ jrough$ tsc -h
-bash: tsc: command not found

:-(

Janis Rough

unread,
Jan 16, 2017, 12:04:26 PM1/16/17
to
Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc \
/var/root/.npm-packages/bin/tsc/tsc
error TS6053: File ' .ts' not found.
Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc/tsc
-bash: /var/root/.npm-packages/bin/tsc/tsc: Not a directory
Janiss-MBP:~ jrough$

tnx

Janis Rough

unread,
Jan 16, 2017, 12:06:21 PM1/16/17
to
Janiss-MBP:~ jrough$ ls -l /var/root/.npm-packages/bin/tsc
lrwxr-xr-x 1 root wheel 38 Jan 15 15:12 /var/root/.npm-packages/bin/tsc -> ../lib/node_modules/typescript/bin/tsc
>
> How about
>
> ls /var/root/.npm-packages/bin

Janiss-MBP:~ jrough$ ls /var/root/.npm-packages/bin
babel npm
babel-doctor tsc
babel-external-helpers tsserver
babel-node typings
ionic

>
> and so on....
>
> Ed.

What did I do? I think I installed Ionic. I wonder if that interferes with typescript. I need typescript for a job.

Ed Morton

unread,
Jan 16, 2017, 12:34:09 PM1/16/17
to
I have no idea what "Iconic" is but whatever it is it's not going to cause a
command in your PATH to not be found.

You didn't post the output of /var/root/.npm-packages/bin/tsc -h but I think
Barry had it right - I didn't notice the /tsc at the end of the line on your
PATH setting. You said something about closing a terminal after setting your
PATH in your response to Barry, idk what that's about either - just do this:

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-package/bin
tsc -h
/var/root/.npm-packages/bin/tsc -h
/var/root/.npm-packages/lib/node_modules/typescript/bin/tsc -h
ls -l /var/root/.npm-packages/lib/node_modules/typescript/bin/tsc

and let us know the results.

Regards,

Ed.

Janis Rough

unread,
Jan 16, 2017, 1:25:07 PM1/16/17
to
On Monday, January 16, 2017 at 8:02:39 AM UTC-8, Helmut Waitzmann wrote:
Janiss-MBP:~ jrough$ ls -Lld -- \
ls: : No such file or directory
Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc \
/var/root/.npm-packages/bin/tsc/tsc

error TS6053: File ' .ts' not found.
Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc/tsc
-bash: /var/root/.npm-packages/bin/tsc/tsc: Not a directory
>

Helmut Waitzmann

unread,
Jan 17, 2017, 12:46:04 AM1/17/17
to
Janis Rough <janis...@gmail.com>:
This is not exactly I suggested. The command

>> ls -Lld -- \
>> /var/root/.npm-packages/bin/tsc \
>> /var/root/.npm-packages/bin/tsc/tsc

is /one/ command consisting of /three/ lines. The »\« characters
at the first and the second line, each of them followed by a
newline character is interpreted by the shell as line
continuation, i. e., they are removed from the command line
together with the newline they precede. As an alternative, you
could run the same command using a single very long line (which is
not very convenient when quoting usenet articles; that's, why I
folded the command line):

ls -Lld -- /var/root/.npm-packages/bin/tsc /var/root/.npm-packages/bin/tsc/tsc

> Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc \
> /var/root/.npm-packages/bin/tsc/tsc
>
> error TS6053: File ' .ts' not found.
> Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc/tsc
> -bash: /var/root/.npm-packages/bin/tsc/tsc: Not a directory
>>
>> Will
>>
>> PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-packages/bin/
>>
>> work?

What do the two commands

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:\
/var/root/.npm-packages/bin
tsc -h

do? (Again, if you like, you can omit the »\« together with the
newline character, that follows it.)

Helmut Waitzmann

unread,
Jan 17, 2017, 12:56:54 AM1/17/17
to
Janis Rough <janis...@gmail.com>:
> On Monday, January 16, 2017 at 8:02:39 AM UTC-8, Helmut Waitzmann wrote:
>> Janis Rough <janis...@gmail.com>:
>> > h-3.2# tsc -h
>> > sh: tsc: command not found
>> >
>> > So my guess is to add it to the Path. I added to the temporary
>> > path and it still says not found. Any ideas?

>> Possibly you added the program file name to the PATH rather
>> than its directory? To investigate this, you could run
>>
>> the command
>>
>> ls -Lld -- \
>> /var/root/.npm-packages/bin/tsc \
>> /var/root/.npm-packages/bin/tsc/tsc
>>
>> What does it show?
> Janiss-MBP:~ jrough$ ls -Lld -- \
> ls: : No such file or directory

This is not exactly what I suggested. The command

>> ls -Lld -- \
>> /var/root/.npm-packages/bin/tsc \
>> /var/root/.npm-packages/bin/tsc/tsc

is /one/ command consisting of /three/ lines. The »\« characters
at the first and the second line, each of them followed by a
newline character is interpreted by the shell as line
continuation, i. e., they are removed from the command line
together with the newline they precede. As an alternative, you
could run the same command using a single very long line (which is
not very convenient when quoting usenet articles; that's, why I
folded the command line):

ls -Lld -- /var/root/.npm-packages/bin/tsc /var/root/.npm-packages/bin/tsc/tsc

> Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc \
> /var/root/.npm-packages/bin/tsc/tsc
>
> error TS6053: File ' .ts' not found.
> Janiss-MBP:~ jrough$ /var/root/.npm-packages/bin/tsc/tsc
> -bash: /var/root/.npm-packages/bin/tsc/tsc: Not a directory
>>
>> Will
>>
>> PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/var/root/.npm-packages/bin/
>>
>> work?

Janis Rough

unread,
Jan 17, 2017, 9:11:12 AM1/17/17
to
well I got something that time. I've done it over and over now it works?Why is that?
Syntax: tsc [options] [file ...]

Examples: tsc hello.ts
tsc --outFile file.js file.ts
tsc @args.txt

Options:
--allowJs Allow javascript files to be compiled.
--allowSyntheticDefaultImports Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
--allowUnreachableCode Do not report errors on unreachable code.
--allowUnusedLabels Do not report errors on unused labels.
--alwaysStrict Parse in strict mode and emit "use strict" for each source file
--baseUrl Base directory to resolve non-absolute module names.
-d, --declaration Generates corresponding '.d.ts' file.
--experimentalDecorators Enables experimental support for ES7 decorators.
--forceConsistentCasingInFileNames Disallow inconsistently-cased references to the same file.
-h, --help Print this message.
--importHelpers Import emit helpers from 'tslib'.
--init Initializes a TypeScript project and creates a tsconfig.json file.
--jsx KIND Specify JSX code generation: 'preserve' or 'react'
--jsxFactory Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.
--lib Specify library files to be included in the compilation:
'es5' 'es6' 'es2015' 'es7' 'es2016' 'es2017' 'dom' 'dom.iterable' 'webworker' 'scripthost' 'es2015.core' 'es2015.collection' 'es2015.generator' 'es2015.iterable' 'es2015.promise' 'es2015.proxy' 'es2015.reflect' 'es2015.symbol' 'es2015.symbol.wellknown' 'es2016.array.include' 'es2017.object' 'es2017.sharedmemory' 'es2017.string'
--mapRoot LOCATION Specify the location where debugger should locate map files instead of generated locations.
--maxNodeModuleJsDepth The maximum dependency depth to search under node_modules and load JavaScript files
-m KIND, --module KIND Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'
--moduleResolution STRATEGY Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).
--newLine NEWLINE Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).
--noEmit Do not emit outputs.
--noEmitOnError Do not emit outputs if any errors were reported.
--noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statement.
--noImplicitAny Raise error on expressions and declarations with an implied 'any' type.
--noImplicitReturns Report error when not all code paths in function return a value.
--noImplicitThis Raise error on 'this' expressions with an implied 'any' type.
--noImplicitUseStrict Do not emit 'use strict' directives in module output.
--noUnusedLocals Report errors on unused locals.
--noUnusedParameters Report errors on unused parameters.
--outDir DIRECTORY Redirect output structure to the directory.
--outFile FILE Concatenate and emit output to single file.
--preserveConstEnums Do not erase const enum declarations in generated code.
--pretty Stylize errors and messages using color and context. (experimental)
-p DIRECTORY, --project DIRECTORY Compile the project in the given directory.
--reactNamespace Specify the object invoked for createElement and __spread when targeting 'react' JSX emit
--removeComments Do not emit comments to output.
--rootDir LOCATION Specify the root directory of input files. Use to control the output directory structure with --outDir.
--skipLibCheck Skip type checking of declaration files.
--sourceMap Generates corresponding '.map' file.
--sourceRoot LOCATION Specify the location where debugger should locate TypeScript files instead of source locations.
--strictNullChecks Enable strict null checks.
--suppressImplicitAnyIndexErrors Suppress noImplicitAny errors for indexing objects lacking index signatures.
-t VERSION, --target VERSION Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'
--traceResolution Enable tracing of the name resolution process.
--types Type declaration files to be included in compilation.
-v, --version Print the compiler's version.
-w, --watch Watch input files.
@<file> Insert command line options and files from a file.
>
> do? (Again, if you like, you can omit the »\« together with the
> newline character, that follows it.)

thanks,

Janis Rough

unread,
Jan 17, 2017, 9:20:14 AM1/17/17
to
Okay the roadblock seems to have cleared. I got this
tsc --init --experimentalDecorators --emitDecoratorMetadata --target ES5 --module system --moduleResolution node
message TS6071: Successfully created a tsconfig.json file.

I'm guessing the path correction fixed it but it only is temporary path so if I opened another window that one didn't work or something like that.
Thank you kindly for your help.

Helmut Waitzmann

unread,
Jan 17, 2017, 2:51:48 PM1/17/17
to
Janis Rough <janis...@gmail.com>:

> Okay the roadblock seems to have cleared. I got this
> tsc --init --experimentalDecorators --emitDecoratorMetadata --target ES5 --module system --moduleResolution node
> message TS6071: Successfully created a tsconfig.json file.
>
> I'm guessing the path correction fixed it but it only is
> temporary path so if I opened another window that one didn't
> work or something like that.

Yes, that's correct. Whenever you start a new shell (for example
by opening a new terminal window by means of your window manager),
that shell must be told the new value for the PATH variable, too.

If you want the path correction to be permanent, you could put the
command

export PATH="${PATH:+${PATH}:}"/var/root/.npm-packages/bin

into your "$HOME"/.profile login shell startup file and logout.

Then, each time you login, the PATH environment variable will be
set. It will be inherited by all shells that are started during
that login session.
0 new messages