Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with node 6.x ... can it be the strict mode? #62

Closed
Apollon77 opened this issue Nov 22, 2016 · 5 comments
Closed

Error with node 6.x ... can it be the strict mode? #62

Apollon77 opened this issue Nov 22, 2016 · 5 comments

Comments

@Apollon77
Copy link
Collaborator

Apollon77 commented Nov 22, 2016

I have my project build by travis-ci with different node versions and with node 6.x the following errr occurs:

winston.transports.DailyRotateFile = DailyRotateFile;
                                   ^
TypeError: Cannot set property DailyRotateFile of #<Object> which has only a getter
    at Object.<anonymous> (/home/travis/build/Apollon77/ioBroker.nut/node_modules/winston-daily-rotate-file/index.js:170:36)
    at Module._compile (module.js:541:32)
   at Object.Module._extensions..js (module.js:550:10)
   at Module.load (module.js:456:32)
   at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/travis/build/Apollon77/ioBroker.nut/tmp/node_modules/iobroker.js-controller/lib/logger.js:6:23)
    at Module._compile (module.js:541:32)

I found something comparabe in Winston issues on github and it was caused by "strict" mode there ... and this lib uses strict mode. Can this be the cause somehow?

@mattberther
Copy link
Member

Cant reproduce this error:

matt@amnesia /src/winston-daily-rotate-file
± |master ✗| → nodenv local 6.9.1 

matt@amnesia /src/winston-daily-rotate-file
± |master ✗| → npm test

> winston-daily-rotate-file@1.3.1 test /src/winston-daily-rotate-file
> mocha && eslint .

  winston/transports/daily-rotate-file
    an instance of the transport
      with default datePatterns
        ✓ should have a proper filename when prepend option is false
        ✓ should have a proper filename when prepend option is false (localtime)
        ✓ should have a proper filename when prepend options is true
        ✓ should remove leading dot if one is provided with datePattern
        ✓ should not add leading dot if one is not provided with datePattern
        ✓ should remove leading dot if one is provided with datePattern when prepend option is true
      when passed a valid file
        ✓ should have the proper methods defined
        with the error level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the warn level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the info level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the verbose level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the debug level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the silly level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
      when passed a valid stream
        ✓ should have the proper methods defined
        with the error level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the warn level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the info level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the verbose level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the debug level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the silly level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
      when passed a valid prepended file
        ✓ should have the proper methods defined
        with the error level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the warn level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the info level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the verbose level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the debug level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the silly level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
      when passed a valid weekday file
        ✓ should have the proper methods defined
        with the error level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the warn level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the info level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the verbose level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the debug level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the silly level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
      when passed a valid prepend weekday file
        ✓ should have the proper methods defined
        with the error level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the warn level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the info level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the verbose level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the debug level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
        with the silly level
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed no metadata
          ✓ should respond with true when passed object metadata
          ✓ should respond with true when passed primitive metadata
          ✓ should respond with true when passed circular metadata
      when passed an invalid filename
        ✓ should have proper methods defined
        ✓ should enter noop failed state
      when passed an valid filename with different date patterns for log rotation
        when passed the pattern full year pattern .yyyy
          ✓ should create log with proper timestamp
        when passed the pattern small year pattern .yy
          ✓ should create log with proper timestamp
        when passed the pattern month pattern .M
          ✓ should create log with proper timestamp
        when passed the pattern zero padded month pattern .MM
          ✓ should create log with proper timestamp
        when passed the pattern daypattern .d
          ✓ should create log with proper timestamp
        when passed the pattern zero padded day pattern .dd
          ✓ should create log with proper timestamp
        when passed the pattern hour pattern .H
          ✓ should create log with proper timestamp
        when passed the pattern zero padded hour pattern .HH
          ✓ should create log with proper timestamp
        when passed the pattern minute pattern .m
          ✓ should create log with proper timestamp
        when passed the pattern zero padded minute pattern .mm
          ✓ should create log with proper timestamp
        when passed the pattern daily rotation pattern .yyyy-MM-dd
          ✓ should create log with proper timestamp
      when passed with maxsize and maxfiles
        when passed the pattern .yyyy-MM-dd
          ✓ should properly rotate log with old files getting deleted
      when passed with maxfiles set and maxsize not set
        when passed the pattern .yyyy-MM-dd and no maxsize
files : test-rotation-no-maxsize.log.2029-01-02,test-rotation-no-maxsize.log.2029-01-03
          ✓ should properly rotate log without maxzsize set and with old files getting deleted


  176 passing (233ms)


/src/winston-daily-rotate-file/index.js
  278:3  warning  Unexpected 'todo' comment  no-warning-comments

✖ 1 problem (0 errors, 1 warning)

@Apollon77
Copy link
Collaborator Author

I also tested further: in live i also can not reproduce it, but when travis-ci is used to test things it breaks with this error ... any idea why?!
see https://travis-ci.org/Apollon77/ioBroker.nut (don't know if reachable from outside)

@mattberther
Copy link
Member

Im not really sure -- the travis build for this project runs just fine.

@Apollon77
Copy link
Collaborator Author

SOLVED: The reason whs an "unmet peer dependency" with npm 3.x and that's why it seems that something was not correctly installed. very strange. After manually installing winston before the real project in travis.yml it worked.
Maybe helps someone else too :-)

@mattberther
Copy link
Member

Great! Thanks for following up. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants