Skip to content

dateFormat = require('dateformat') #49

@ghost

Description

Hey guys, how are you?

I have had a problem recently in my applicatoin the error it's

`/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/lib/handlers/client/security/security.js:5
, dateFormat = require('dateformat')
^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/dateformat/lib/dateformat.js from /Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/lib/handlers/client/security/security.js not supported.
Instead change the require of dateformat.js in /Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/lib/handlers/client/security/security.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/lib/handlers/client/security/security.js:5:18)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/lib/ws.js:9:20)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/ws.js/index.js:1:18)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/helpers/index.js:6:12)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/test/unit/controllers/ordem/mock/processarOrdemMock/index.js:184:17)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/test/unit/controllers/ordem/mock/index.js:1:28)
at /Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/mocha/lib/mocha.js:250:27
at Array.forEach ()
at Mocha.loadFiles (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/mocha/lib/mocha.js:247:14)
at Mocha.run (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/mocha/lib/mocha.js:576:10)
at Object. (/Users/astesio.junior/workspace/work/pi/general/negociacao/app/node_modules/mocha/bin/_mocha:637:18) {
code: 'ERR_REQUIRE_ESM'`

I try use a lot different version node js (8.0.0, 9.0.0, 10.0.0, 14.000 and 16.13.0)
My project is a legacy, I tried to go back to the version in which it worked anymore, it's not working anymore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions