question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with strict mode

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
coolnalucommented, May 2, 2016

same issue.

2reactions
vedraancommented, Feb 25, 2016

+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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strict mode in JavaScript - GeeksforGeeks
Strict Mode was a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “strict” operating...
Read more >
Strict mode - Angular
Angular CLI creates all new workspaces and projects with strict mode enabled. Strict mode improves maintainability and helps you catch bugs ahead of...
Read more >
Turning off Strict Mode in Angular? - Stack Overflow
Following Angular doc, the strict mode can be disabled turning off these flags on tsconfig.json file:
Read more >
Why to and How To Use Strict Mode in Angular Applications
For sure I took a look at the tsconfig.json and found the reason for these problems — the strict mode was not enabled....
Read more >
What Is Strict Mode In TypeScript, Why And When You Should ...
Strict mode constricts you in ways of writing your code. On other hand, you won't choose the way that will bring you to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found