design-systems-cli icon indicating copy to clipboard operation
design-systems-cli copied to clipboard

yarn start: 'tsc' is not recognized as an internal or external command

Open jasonrundell opened this issue 5 years ago • 21 comments

Describe the bug

Project does not start due to tsc not being present.

To Reproduce

  1. Fork repo
  2. Run yarn
  3. Run yarn start

Expected behavior

Success output.

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 10 Home
  • Browser N/A
  • Version No version present in intuit/design-systems-cli

jasonrundell avatar Sep 25 '20 16:09 jasonrundell

If you want to add this to hacktoberfest I can try and submit a PR for the fix.

jasonrundell avatar Sep 25 '20 16:09 jasonrundell

Go for it

hipstersmoothie avatar Sep 25 '20 17:09 hipstersmoothie

@hipstersmoothie which approach do you prefer?

  1. Assume TypeScript is installed on user's machine: add something to the README explaining this assumption and instructions on how to install TS.

  2. Add typescript to the package.json?

jasonrundell avatar Sep 25 '20 17:09 jasonrundell

Add typescript to the package.json?

It's already declared as a dependency: https://github.com/intuit/design-systems-cli/blob/master/package.json#L46

adierkens avatar Sep 25 '20 17:09 adierkens

Add typescript to the package.json?

It's already declared as a dependency: https://github.com/intuit/design-systems-cli/blob/master/package.json#L46

Why is tsc not included?

jasonrundell avatar Sep 25 '20 17:09 jasonrundell

Maybe a windows thing? Potentially a npm/node versioning issue? I just tried a clean clone of the repo and did yarn and yarn start without issue -- but i'm on a macbook. If you're able to diagnose the problem, i'd be curious to know what the underlying issue is.

adierkens avatar Sep 25 '20 17:09 adierkens

I would like to work on this issue, I can test the solution in both platforms

pixeleate avatar Sep 27 '20 01:09 pixeleate

I have tested this on Windows 10 Home / Pro, Mac and Linux (Ubuntu), everything is running fine for me, no errors following the indicated steps.

pixeleate avatar Sep 27 '20 05:09 pixeleate

I have tested this on Windows 10 Home / Pro, Mac and Linux (Ubuntu), everything is running fine for me, no errors following the indicated steps.

Ok interesting. I'm using a fresh Windows after adding all new hardware. I'm going to start digging into this issue this week.

jasonrundell avatar Sep 28 '20 02:09 jasonrundell

I have tested this on Windows 10 Home / Pro, Mac and Linux (Ubuntu), everything is running fine for me, no errors following the indicated steps.

What happens if you type tsc in your Windows terminal? Also, which Windows terminal are you using? PowerShell? bash?

jasonrundell avatar Sep 28 '20 13:09 jasonrundell

Just an update that I also can reproduce the same error on my work Mac image image

jasonrundell avatar Sep 29 '20 19:09 jasonrundell

@hipstersmoothie can confirm that installing TypeScript locally is what corrects this error.

Can I PR in a README change to help new users make sure they have the pre-requisite software installed as global libraries on their machine before they use the design systems cli?

jasonrundell avatar Sep 29 '20 20:09 jasonrundell

I don't have typescript installed locally, I'm not seeing the error, and it shouldn't be a pre-requisite, one possible solution could be rather that using the tsc alone, you can use the path to local executable ./node_modules/.bin/tsc.

I'm using zsh as my shell interpreter in Mac, Linux and Windows

pixeleate avatar Sep 29 '20 20:09 pixeleate

you can use the path to local executable ./node_modules/.bin/tsc.

Any hard-coded path implies an OS (windows has the opposite path separators). I would expect a lot of this to be handled by yarn internally. Could it be a yarn issue? What version are you using? Does it behave the same if you use node start instead of yarn start?

adierkens avatar Sep 29 '20 20:09 adierkens

I don't have typescript installed locally, I'm not seeing the error, and it shouldn't be a pre-requisite, one possible solution could be rather that using the tsc alone, you can use the path to local executable ./node_modules/.bin/tsc.

I'm using zsh as my shell interpreter in Mac, Linux and Windows

I get no node_modules after running yarn or yarn install

jasonrundell avatar Sep 29 '20 20:09 jasonrundell

I get no node_modules after running yarn or yarn install

That seems like the underlying problem. Are you on yarn-v1 or yarn-v2?

adierkens avatar Sep 29 '20 20:09 adierkens

I get no node_modules after running yarn or yarn install

That seems like the underlying problem. Are you on yarn-v1 or yarn-v2?

version 1.22.5

jasonrundell avatar Sep 29 '20 20:09 jasonrundell

I don't have typescript installed locally, I'm not seeing the error, and it shouldn't be a pre-requisite, one possible solution could be rather that using the tsc alone, you can use the path to local executable ./node_modules/.bin/tsc. I'm using zsh as my shell interpreter in Mac, Linux and Windows

I get no node_modules after running yarn or yarn install

That's exactly the reason because tsc is not working for you.

I'm using [email protected], [email protected] and [email protected], everything working without any issue

pixeleate avatar Sep 29 '20 20:09 pixeleate

@jasonrundell I can see the following line in your terminal output: image that mean that you're getting an error installing the modules, you should upgrade your node version to at least 10.18.1, and that could be the minimum required version, this could be added to the readme.

I feel that if you upgrade you will not have any problem again.

pixeleate avatar Sep 29 '20 20:09 pixeleate

Upgraded to node version v12.18.4 and yarn install finished node_modules download.

yarn start looks to be working correctly...

[4:48:11 PM] Starting compilation in watch mode...

[4:49:22 PM] Found 0 errors. Watching for file changes.

Ok, so should the README declare the minimum version of node to be 10.18.1?

jasonrundell avatar Sep 29 '20 20:09 jasonrundell

You could just add the engines section to the package.json that will show an error to the users if they are using a different version and will suggest which one should be used

"engines": {
    "node": ">=10.18.1"
}

Along with that a badge with the expected node version can be added to the README.

node-current badge

pixeleate avatar Sep 29 '20 21:09 pixeleate