Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

543
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!