Winston: Issue with strict mode

Created on 20 Nov 2015  Â·  11Comments  Â·  Source: winstonjs/winston

Hello,

Currently starting a CI on Codeship using winston. Using babel.

Whenever I try to run my tests i get a

Warning: api/node_modules/winston/lib/winston/common.js: Invalid number (367:30) Use --force to continue.

This might be related to the Octal litteral at 367:30. Fixing this pops another error, also relating to strict mode, about callee, caller and arguments. No line passed to the error stack.

Most helpful comment

same issue.

All 11 comments

@vroudge could you try upgrading to the latest version of winston? There is no longer an octal literal being used.

Oh yeah my bad, I didn't check the version enforcement on my repo. Sorry :+1:

TypeError: Cannot set property Console of [object Object] which has only a getter at Object.get 
as Console (/home/rof/src/github.com/***/***/node_modules/winston/lib/winston/transports.js:23:31)

Still getting this error, for instance, which seem pretty related to strict mode too.

@vroudge could you post a small snippet of code that reproduces this? if you can turn it into a test that would be great. Just need to discern the usage -> error :)

If I could, trust me, I would.

I get this issue when launching my tests via grunt.

Here is my full estack.

â–½
TypeError: Cannot set property Console of [object Object] which has only a getter

â–½
at Object.get as Console     (/home/rof/src/github.com/$$$/api/node_modules/winston/lib/winston/transports.js:23:31)
at new exports.Container (/home/rof/src/github.com/$$$/api/node_modules/winston/lib/winston/container.js:24:29)
at Object.<anonymous> (/home/rof/src/github.com/**/api/node_modules/winston/lib/winston.js:51:19)
at Module._compile (module.js:456:26)
at normalLoader (/home/rof/src/github.com/$$$/api/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .js (/home/rof/src/github.com/**/api/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)

Can't really help beyond that, I'm afraid.

@vroudge i need to see the code that uses winston otherwise we cannot make progress at diagnosing WHY this happens.

this was fixed in a recent merged PR. version will be bumped later today most likely.

this issue still occurs, because there is no newer version with this fix

+1

+1 really need this to work in strict mode as well.

To reproduce just try creating a winston.js file with the following content:

const winston = require('winston');

and run it using:

node --use-strict winston.js

You get:

/project_home/node_modules/winston/lib/winston/transports.js:23
          return exports[name] = require(fullpath)[name];
                               ^

TypeError: Cannot set property Console of #<Object> which has only a getter
    at Object.acc.(anonymous function).get [as Console] (/project_home/node_modules/winston/lib/winston/transports.js:23:32)
    at new exports.Container (/project_home/node_modules/winston/lib/winston/container.js:24:29)
    at Object.<anonymous> (/project_home/node_modules/winston/lib/winston.js:51:19)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/project_home/winston.js:1:79)

Quick fix (in case this doesn't get released soon), add winston to your package json like this and run npm install:

"winston": "winstonjs/winston"

This pulls the master version which works with --use-strict (no issues noticed).

same issue.

Was this page helpful?
0 / 5 - 0 ratings