Search code examples
node.jstypescriptnpmyarnpkg

Trying to execute "npx typescript --init" "npm ERR! could not determine executable to run"


What does the error npm ERR! could not determine executable to run mean?

I'm trying to initialise a simple nodejs app with typescript and yarn. I've never really used yarn before.

I've ran the commands: yarn init Which successfully creates a package.json npx typescript --init Gives me the above error message.

Versions: yarn v1.22.11 npx 7.12.0

I've ran yarn add typescript and it gives me:

info Direct dependencies
└─ typescript@4.3.5
info All dependencies
└─ typescript@4.3.5

But when I try typescript -v I get typescript: command not found


Solution

  • The fix was to use the command npx tsc --init.

    I don't know why the tutorial I was following used npx typescript --init, but it worked for them and not for me.