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

dateFormat = require('dateformat') #49

Open
ghost opened this issue Dec 7, 2021 · 1 comment
Open

dateFormat = require('dateformat') #49

ghost opened this issue Dec 7, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 7, 2021

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

@matsimao
Copy link

try this command:
npm install [email protected]

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

1 participant