ion icon indicating copy to clipboard operation
ion copied to clipboard

sh: tsc: command not found

Open treasersimplifies opened this issue 2 years ago • 3 comments

I followed cli.md and encountered some error when npm run build:

$ npm run build
> [email protected] build
> tsc && copyfiles "json/**/*.json" dist && copyfiles "tests/**/*.json" dist && copyfiles "tests/**/*.js*" dist

sh: tsc: command not found

treasersimplifies avatar Aug 21 '21 13:08 treasersimplifies

Hmm, might need to install the tsc package globally? Can you try that and let me know?

csuwildcat avatar Aug 21 '21 15:08 csuwildcat

I ran into this problem for the install instructions as well.

https://github.com/decentralized-identity/ion/blob/master/install-guide.md

NOTE: You may nee to run npm install tsc before running npm run build to install TypeScript in Linux/Mac environments.

I think these instructions are incorrect. The package that provides tsc on the command line is typescript -g. And you need to be using the specific version used in the package.json file, which is 3.9.6 (I got build errors when I tried running on the latest). So the instructions should be run:

$ npm install [email protected] -g

Before running npm run build. Alternatively npx should use the version used in the dev dependencies. So the build command in the package.json file could be changed to:

  "scripts": {
    "build": "npx tsc && copyfiles \"json/**/*.json\" dist && copyfiles \"tests/**/*.json\" dist && copyfiles \"tests/**/*.js*\" dist",

To avoid having to install the correct version of tsc globally.

BenjaminMoe avatar Oct 19 '21 14:10 BenjaminMoe

avoid installing packages globally, since the global version can be different than the one assumed by package.json... use npx and dev dependencies, and scripts in package.json.

OR13 avatar Oct 19 '21 14:10 OR13