1
resposta

Problema com TYPESCRIPT VUE no UBUNTU!

Não estou conseguindo prosseguir com este curso. Acho q o meu projeto ou algo no node não esta reconhecendo o TypeScript. Como eu soluciono isso. Segue o erro:

> alura-tracker@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...


 ERROR  Failed to compile with 3 errors                                                                                                                                 8:57:39 AM

[eslint] 
/home/walyssondosreis/Documents/alura-tracker/src/components/Formulario.vue
  41:25  error  Parsing error: Unexpected token, expected "{" (12:25)

✖ 1 problem (1 error, 0 warnings)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
 error  in ./src/components/Formulario.vue?vue&type=script&lang=ts

Module parse failed: Unexpected token (12:25)
File was processed with these loaders:
 * ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
|     },
|     computed: {
>         tempoDecorrido() : string {
|             return new Date(this.tempoEmSegundos * 1000).toISOString().substring(11,8);
|         }

 error  in ./src/components/Formulario.vue?vue&type=template&id=70e411bc&ts=true

Module parse failed: Unexpected token (35:27)
File was processed with these loaders:
 * ./node_modules/vue-loader/dist/templateLoader.js
 * ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
| ]
| 
> export function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {
|   return (_openBlock(), _createElementBlock("div", _hoisted_1, [
|     _createElementVNode("div", _hoisted_2, [

ERROR in ./src/components/Formulario.vue?vue&type=script&lang=ts (./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Formulario.vue?vue&type=script&lang=ts) 12:25
Module parse failed: Unexpected token (12:25)
File was processed with these loaders:
 * ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
|     },
|     computed: {
>         tempoDecorrido() : string {
|             return new Date(this.tempoEmSegundos * 1000).toISOString().substring(11,8);
|         }
 @ ./src/components/Formulario.vue?vue&type=script&lang=ts 1:0-132 1:0-132 1:133-254 1:133-254
 @ ./src/components/Formulario.vue 2:0-61 3:0-56 3:0-56 6:49-55
 @ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/App.vue?vue&type=script&lang=js 3:0-53 8:4-14
 @ ./src/App.vue?vue&type=script&lang=js 1:0-189 1:0-189 1:190-368 1:190-368
 @ ./src/App.vue 2:0-54 3:0-49 3:0-49 6:49-55
 @ ./src/main.js 2:0-28 4:10-13

ERROR in ./src/components/Formulario.vue?vue&type=template&id=70e411bc&ts=true (./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Formulario.vue?vue&type=template&id=70e411bc&ts=true) 35:27
Module parse failed: Unexpected token (35:27)
File was processed with these loaders:
 * ./node_modules/vue-loader/dist/templateLoader.js
 * ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
| ]
| 
> export function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {
|   return (_openBlock(), _createElementBlock("div", _hoisted_1, [
|     _createElementVNode("div", _hoisted_2, [
 @ ./src/components/Formulario.vue?vue&type=template&id=70e411bc&ts=true 1:0-209 1:0-209
 @ ./src/components/Formulario.vue 1:0-79 6:68-74 16:78-18:3 17:29-35 16:2-18:4
 @ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/App.vue?vue&type=script&lang=js 3:0-53 8:4-14
 @ ./src/App.vue?vue&type=script&lang=js 1:0-189 1:0-189 1:190-368 1:190-368
 @ ./src/App.vue 2:0-54 3:0-49 3:0-49 6:49-55
 @ ./src/main.js 2:0-28 4:10-13

ERROR in [eslint] 
/home/walyssondosreis/Documents/alura-tracker/src/components/Formulario.vue
  41:25  error  Parsing error: Unexpected token, expected "{" (12:25)

✖ 1 problem (1 error, 0 warnings)


webpack compiled with 3 errors
1 resposta

Oi,

Você testou a configuração do projeto: Certifique-se de ter um arquivo tsconfig.json corretamente configurado na raiz do seu projeto. Verifique se o arquivo existe e se as configurações estão corretas. Caso contrário, você pode criar um arquivo tsconfig.json com as configurações necessárias. O erro que você está enfrentando parece estar relacionado à compilação do TypeScript no seu projeto Vue. espero te ajudar a resolver esse problema. Verifique se o TypeScript está instalado: Certifique-se de ter o TypeScript instalado no seu projeto. Você pode instalá-lo executando o seguinte comando no terminal, na pasta raiz do seu projeto:

css

npm install typescript --save-dev