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

544
Visualizações
Compilation error : Cannot find module 'util'

I'm new programmer on angular2. I have problem when compile with angular cli.

I generate angular 2 project by angular cli. I'm trying to use debuglog module on node_modules/@types/node by import module like this: import {debuglog} from "util"; I use Webstorm IDE for develop and the ide do not warning or error with my import. I checked and found debuglog module in path: myproject/node_modules/@types/node/index.d.ts.

What's wrong in my code? Have any suggestion for fix it?

Project on Github: https://github.com/sinhpn92/angular2-example-types-node

Version of environments:

@angular/cli: 1.0.0-rc.1
node: 7.7.1
os: darwin x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/upgrade: 2.2.4
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

enter image description here

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

0

This solved the issue for me - https://github.com/angular/angular-cli/wiki/stories-third-party-lib

"types": [
  "node"
]

in tsconfig.app.json.

about 4 years ago · Santiago Trujillo Relatório

0

Noticed that your tsconfig.json lacks the following entry in compilerOptions:

compilerOptions{
//......,
 "typeRoots": [
      "node_modules/@types"
    ]
 }

Try adding it.

about 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