sourcegraph/javascript-typescript-langserver

Install fails, build from source fails

dhazel opened this issue · 7 comments

When installing via npm on windows 7, npm -g install javascript-typescript-langserver, the following error results. The lib directory is missing.

error enoent ENOENT: no such file or directory, chmod 'C:\Users\MyUsername\AppData\Roaming\npm\node_modules\javascript-typescript-langserver\lib\language-server.js'

Also, perhaps unrelated, when attempting to run from source per the instructions in the readme, npm run build, all I am getting is the help message for how to use tsc. No build is happening.

These both seem like simple things that should just work. Perhaps I am missing something obvious?

The lib directory with language-server.js is definitely in the npm package: https://unpkg.com/javascript-typescript-langserver@2.11.1/lib/

npm -g install javascript-typescript-langserver works for me:

> npm i -g javascript-typescript-langserver
/Users/felix/src/ps-nvm/vs/v10.10.0/bin/javascript-typescript-stdio -> /Users/felix/src/ps-nvm/vs/v10.10.0/lib/node_modules/javascript-typescript-langserver/lib/language-server-stdio.js
/Users/felix/src/ps-nvm/vs/v10.10.0/bin/javascript-typescript-langserver -> /Users/felix/src/ps-nvm/vs/v10.10.0/lib/node_modules/javascript-typescript-langserver/lib/language-server.js
+ javascript-typescript-langserver@2.11.1
added 196 packages from 119 contributors in 13.876s

And npm run build works for me:

> npm install
npm WARN @phenomnomnominal/tsquery@2.0.1 requires a peer of typescript@^2 but none is installed. You must install peer dependencies yourself.
npm WARN tslint-language-service@0.9.9 requires a peer of typescript@>= 2.3.1 < 3 but none is installed. You must install peer dependencies yourself.

added 37 packages from 55 contributors, removed 202 packages, updated 149 packages and audited 2846 packages in 7.255s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
✔ ~/src/github.com/sourcegraph/javascript-typescript-langserver [master ≡ +0 ~1 -0 !]
> npm run build

> javascript-typescript-langserver@0.0.0-development build /Users/felix/src/github.com/sourcegraph/javascript-typescript-langserver
> tsc

What version of npm and node are you running?

Weird. I was on npm 5.
After upgrading to npm 6 I no longer have the install problem. Yay!
However, I do still have the build problem. Are you not seeing the same usage message after the > tsc line?

$ npm run build

> javascript-typescript-langserver@0.0.0-development build C:\path\to\my\repo\javascript-typescript-langserver
> tsc

Version 1.0.3.0
Syntax:   tsc [options] [file ..]

Examples: tsc hello.ts
          tsc --out foo.js foo.ts
          tsc @args.txt

Options:
  --codepage NUMBER             Specify the codepage to use when opening sourcefiles.
  -d, --declaration             Generates corresponding .d.ts file.
  -h, --help                    Print this message.
  --mapRoot LOCATION            Specifies the location where debugger should locate map files instead of generated locations.
  -m KIND, --module KIND        Specify module code generation: 'commonjs' or 'amd'
  --noImplicitAny               Warn on expressions and declarations with an implied 'any' type.
  --out FILE                    Concatenate and emit output to single file.
  --outDir DIRECTORY            Redirect output structure to the directory.
  --removeComments              Do not emit comments to output.
  --sourcemap                   Generates corresponding .map file.
  --sourceRoot LOCATION         Specifies the location where debugger should locate TypeScript files instead of source locations.
  -t VERSION, --target VERSION  Specify ECMAScript target version: 'ES3' (default), or 'ES5'
  -v, --version                 Print the compiler's version: 1.0.3.0
  @<file>                       Insert command line options and files from a file.

No, the command runs (building), then exits.

Does it work if you run tsc manually? What if you change the script to tsc -p .?

Running tsc manually gives me the same usage message.

And the other command...

$ tsc -p .
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
error TS5007: Cannot resolve referenced file: '.'.

$ tsc --version
Version 1.0.3.0

Did you run tsc -p . in your terminal or through npm run build? It's important because npm run will use the local version in node_modules.

Btw, did you run npm install before running npm run build?

Okay! I ran npm install back when I was on npm 5, which apparently left out a few things.
I just tried npm install again using npm 6, and after that npm run build is working.

Thanks @felixfbecker !
I am closing the issue.