Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

Solucionado (ver solução)

Dificuldade na instalação e configuração do compilador

Boa tarde a Todos,

Eu tinha instalado o node na minha maquina, porem, instalei uma outra versão.

Agora, quando tento continuar com o curso não consigo (estou revisando o curso):

Quando executo o comendo: npm rum compile apresenta o erro abaixo, como corrigir?

> alurabank@1.0.0 compile C:\Angular\TypeScript 1\alurabankAulaCinco
> tsc

'tsc' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alurabank@1.0.0 compile: `tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alurabank@1.0.0 compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Vinicius\AppData\Roaming\npm-cache\_logs\2021-01-10T19_35_56_251Z-debug.log

Segue o arquivo log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'compile'
1 verbose cli ]
2 info using npm@6.14.10
3 info using node@v14.15.4
4 verbose run-script [ 'precompile', 'compile', 'postcompile' ]
5 info lifecycle alurabank@1.0.0~precompile: alurabank@1.0.0
6 info lifecycle alurabank@1.0.0~compile: alurabank@1.0.0
7 verbose lifecycle alurabank@1.0.0~compile: unsafe-perm in lifecycle true
8 verbose lifecycle alurabank@1.0.0~compile: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Angular\TypeScript 1\alurabankAulaCinco\node_modules\.bin;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Java\jdk1.8.0_172\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\apache-maven\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Vinicius\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Java\jdk1.8.0_172\bin;C:\Users\Vinicius\AppData\Local\atom\bin;C:\Users\Vinicius\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Vinicius\AppData\Roaming\npm
9 verbose lifecycle alurabank@1.0.0~compile: CWD: C:\Angular\TypeScript 1\alurabankAulaCinco
10 silly lifecycle alurabank@1.0.0~compile: Args: [ '/d /s /c', 'tsc' ]
11 silly lifecycle alurabank@1.0.0~compile: Returned: code: 1  signal: null
12 info lifecycle alurabank@1.0.0~compile: Failed to exec compile script
13 verbose stack Error: alurabank@1.0.0 compile: `tsc`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid alurabank@1.0.0
15 verbose cwd C:\Angular\TypeScript 1\alurabankAulaCinco
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "compile"
18 verbose node v14.15.4
19 verbose npm  v6.14.10
20 error code ELIFECYCLE
21 error errno 1
22 error alurabank@1.0.0 compile: `tsc`
22 error Exit status 1
23 error Failed at the alurabank@1.0.0 compile script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

tsconfig.json

{
    "compilerOptions": {
        "target": "es6",
        "outDir": "app/js",
        "noEmitOnError": true, 
        "noImplicitAny": true        
    },
    "include": [
        "app/ts/**/*"
    ]
}

package.json

{
  "name": "alurabank",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "compile": "tsc",
    "start": "tsc -w"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "typescript": "^2.3.2"
  }
}
1 resposta
solução

Fala ai Vinicius, tudo bem? Estranho, por algum motivo não está reconhecendo a instalação do typescript, tente instalá-lo novamente.

Ou rode o comando npm ci.

Espero ter ajudado.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software