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
I have a Monorepo with expressjs and react in typescript.
can succesfully run commands like yarn workspace client start and yarn workspace server dev but when i use concurrently for running the both commands together i get error like this.
yarn run v1.22.19
$ concurrently "yarn workspace server dev" "yarn workspace client start"
/home/jaikaran/projects/file-share/node_modules/cliui/build/index.cjs:293
const wrap = require('wrap-ansi');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/jaikaran/projects/file-share/node_modules/wrap-ansi/index.js from /home/jaikaran/projects/file-share/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /home/jaikaran/projects/file-share/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/jaikaran/projects/file-share/node_modules/cliui/build/index.cjs:293:14) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v20.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
here is my Monorepo package.json
"name": "file-share",
"version": "1.0.0",
"description": "Effortlessly share your files from your personal storage with friends across the internet.",
"main": "index.js",
"author": "Jaikaran Saini",
"license": "MIT",
"private": true,
"workspaces": [
"server",
"client"
],
"scripts": {
"client": "yarn workspace client start",
"server": "yarn workspace server dev",
"dev": "concurrently \"yarn workspace server dev\" \"yarn workspace client start\""
},
"devDependencies": {
"@types/concurrently": "^7.0.0",
"concurrently": "^8.2.2"
}
}
``Solved by make changes in node_modules/cliui/build/index.cjs:293:14 file
commented this code // const wrap = require('wrap-ansi');
and added below code
let wrap;
async function loadWrapAnsi() {
let wrap;
try {
const wrapModule = await import('wrap-ansi');
wrap = wrapModule.default; // Assuming wrap-ansi exports a default export
} catch (err) {
// Handle import error if necessary
console.error('Failed to import wrap-ansi:', err);
}
return wrap;
}
loadWrapAnsi();
I have a Monorepo with expressjs and react in typescript.
can succesfully run commands like
yarn workspace client start
andyarn workspace server dev
but when i useconcurrently
for running the both commands together i get error like this.here is my Monorepo
package.json
here is Client
package.json
and this is my server
package.json
fileThe text was updated successfully, but these errors were encountered: