Home > Software design >  Nodejs process.report is undefined?
Nodejs process.report is undefined?

Time:01-31

In nodejs I'm doing:

import * as process from 'process';

console.log(process.report); // undefined

and I'm getting undefined. "node -v" gives me v16.13.2.

Does anyone knows why?

CodePudding user response:

It looks like the docs are wrong and the process module is not fully esm ready.

import { report } from 'process';
         ^^^^^^
SyntaxError: The requested module 'process' does not provide an export named 'report'

Above error is the reason, why import * as process from 'process' gives undefined.

You can use the default export or use CommonJs for the time being I would argue.

import process from 'process';

console.log(process.report);
  •  Tags:  
  • Related