Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

546
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda