Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

946
Visualizações
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

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

Expanding on JimmyTheCode's answer, it works because tsc is a dummy package that only installs typescript.

The correct way to solve this without installing yet another package is by using the -p|--package option on npx. This flag is useful when calling a specific binary from a package.

npx --package typescript tsc --init
# OR
npx -p typescript tsc --init

You can find out more on npx's documentation.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda