You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After installing the package and rerun yarn start:dev, the will refuse to start and output the following: const stringWidth = require('string-width');
the full output is the following:
$ nest start --watch --reset-cache
/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/wrap-ansi/index.js:2
const stringWidth = require('string-width');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/string-width/index.js from /Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/wrap-ansi/index.js not supported.
Instead change the require of /Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/string-width/index.js in /Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/wrap-ansi/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/wrap-ansi/index.js:2:21)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/utils/screen-manager.js:4:18)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/prompts/base.js:14:23)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/prompts/list.js:11:14)
at promptModule.restoreDefaultPrompts (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/inquirer.js:61:33)
at inquirer.createPromptModule (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/inquirer.js:72:16)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/inquirer/lib/inquirer.js:84:28)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/lib/utils/project-utils.js:4:18)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/actions/generate.action.js:9:25)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/actions/index.js:19:14)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/commands/command.loader.js:5:19)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/commands/index.js:17:14)
at Object.<anonymous> (/Users/tony/workspace/freelance/kurisani/server-app/ftx-server/node_modules/@nestjs/cli/bin/nest.js:5:20) {
code: 'ERR_REQUIRE_ESM'
}
I believe that you just need to remove the lock file and install everything again
Also, instead of using nest globally, I'd suggest you to use it once like this: npx @nestjs/cli new and then use the local one (yarn nest generate ...)
I too have had the same problem these weeks working with yarn.
The problem, from what I understand, is yarn, removing the yarn.lock file and doing the yarn installation should solve it. it also happens with projects already created after downloading a repository and doing the yarn installation.
With pnpm this problem does not occur even with versions of yarn higher than v1.22.21, I think it is a problem with 1.22.21.
Is there an existing issue for this?
Current behavior
After installing the package and rerun
yarn start:dev
, the will refuse to start and output the following:const stringWidth = require('string-width');
the full output is the following:
Minimum reproduction code
git@github.com:vfxproForex/ftx-server.git
Steps to reproduce
npx nestjs new test-app
yarn add @nestjs/platform-express express express-session
yarn add -D @types/express @types/express-session
yarn start:dev
Expected behavior
The server is expected to run normally
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
non
NestJS version
10.0.0
Packages versions
Node.js version
20.9.0
In which operating systems have you tested?
Other
sdsd
The text was updated successfully, but these errors were encountered: