ecs-logging-nodejs icon indicating copy to clipboard operation
ecs-logging-nodejs copied to clipboard

[@elastic/ecs-winston-format] Missing `triple-beam` dependency

Open rtritto opened this issue 3 years ago • 0 comments

loggers/winston/index.js file use triple-beam dependency that's not included in package.json dependencies:

...
const { MESSAGE } = require('triple-beam')
...

Steps to reproduce

  1. yarn init -y
  2. yarn set version berry
  3. yarn add @elastic/ecs-winston-format winston
  4. Create index.js file
const winston = require('winston')
const ecsFormat = require('@elastic/ecs-winston-format')

const logger = winston.createLogger({
  level: 'info',
  format: ecsFormat(),
  transports: [
    new winston.transports.Console()
  ]
})

logger.info('test1')
  1. yarn node index
C:\test-ecs-winston\.pnp.cjs:10188
    throw firstError;
    ^

Error: @elastic/ecs-winston-format tried to access triple-beam, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: triple-beam
Required by: @elastic/ecs-winston-format@npm:1.3.1 (via C:\test-ecs-winston\.yarn\cache\@elastic-ecs-winston-format-npm-1.3.1-8fc543f859-49a7767c64.zip\node_modules\@elastic\ecs-winston-format\)

Require stack:
- C:\test-ecs-winston\.yarn\cache\@elastic-ecs-winston-format-npm-1.3.1-8fc543f859-49a7767c64.zip\node_modules\@elastic\ecs-winston-format\index.js
- C:\test-ecs-winston\index.js
    at Function.external_module_.Module._resolveFilename (C:\test-ecs-winston\.pnp.cjs:10187:55)       
    at Function.external_module_.Module._load (C:\test-ecs-winston\.pnp.cjs:9986:48)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\test-ecs-winston\.yarn\cache\@elastic-ecs-winston-format-npm-1.3.1-8fc543f859-49a7767c64.zip\node_modules\@elastic\ecs-winston-format\index.js:20:21)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.external_module_.Module._load (C:\test-ecs-winston\.pnp.cjs:10036:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)

rtritto avatar Nov 20 '21 12:11 rtritto