Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

type script nao compila

quando tento executar o comando de compilação pela primeira vez (com o Arquivo Negociacao.ts nao alterado)o comando é executado e a acao marca no arquivo Negociacao.ts os erros, pois o mesmo ainda nao foi alterado para o formato typescript. Gostaria de saber se a mensagem abaixo representa algum problema.

C:\alurabank>npm run compile

alurabank@1.0.0 compile C:\alurabank tsc

error TS5014: Failed to parse file 'C:/alurabank/tsconfig.json': Unexpected toke n } in JSON at position 150.

npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\ node_modules\npm\bin\npm-cli.js" "run" "compile" npm ERR! node v6.17.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE 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 'tsc'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the alurabank package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! tsc npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs alurabank npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls alurabank npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\alurabank\npm-debug.log

Quando o arquivo Negociacao.ts é corrigido e executo o comando de compilacao acontece esse erro e o arquivo app/js/models/Negociacao.js não é criado.

C:\alurabank>npm run compile

alurabank@1.0.0 compile C:\alurabank tsc

error TS5014: Failed to parse file 'C:/alurabank/tsconfig.json': Unexpected toke n } in JSON at position 150.

npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\ node_modules\npm\bin\npm-cli.js" "run" "compile" npm ERR! node v6.17.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE 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 'tsc'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the alurabank package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! tsc npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs alurabank npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls alurabank npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\alurabank\npm-debug.log

Já fiz isso em 2 computadores diferente e o erro é sempre o mesmo

2 respostas

Boa noite Marcio,

error TS5014: Failed to parse file 'C:/alurabank/tsconfig.json': Unexpected toke n } in JSON at position 150.

Essa linha acima está dizendo que existe um erro no arquivo tsconfig.json na linha 150. Recomendo dar uma olhada nele e se possível comparar com o projeto da aula.

Como esse arquivo é responsável pelas configurações do typescript é possível que em alguma alteração que você fez ele tenha ficado inválido. Com ele inválido o processo de compilação não irá funcionar. Se não encontrar o erro poste o conteúdo do arquivo aqui.

Abraços

solução!

Resolvi o problema configurando o arquivo tsconfig.json da seguinte forma: { "compilerOptions": { "target": "es6" ,"outDir": "app/js" ,"noEmitOnError":true ,"noImplicitAny":true }, "include": [ "app/ts/*/" ] } com a virgula antes do comando

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