Comments (3)
if i add ansi-styles to my dependencies I get
/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/chalk/source/index.js:2
const ansiStyles = require('ansi-styles');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/ansi-styles/index.js from /home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/chalk/source/index.js not supported.
Instead change the require of /home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/ansi-styles/index.js in /home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/chalk/source/index.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/chalk/source/index.js:2:20)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/src/utils/code-frames.js:5:15)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/src/utils/json.js:7:23)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/src/utils/fileutils.js:4:16)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/src/utils/workspace-root.js:5:21)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/src/utils/find-workspace-root.js:4:26)
at Object. (/home/kranua/main/dev/fiverr/ale_pereira/SPO-AdminPanel/node_modules/nx/bin/nx.js:4:31) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v18.18.1
I'm not sure if this helps
from nx.
For the Cannot find module 'ansi-styles'
error, it might be how the packages are hoisted by npm. Can you run npm ls ansi-styles
and paste the result?
Also, can you remove node_modules
and reinstall to see if the error goes away?
For the ESM subsequent error, do you have "type": "module"
set in package.json
? If that is set, then Node will load ESM rather than CJS.
from nx.
thanks for the suggestion. removing node_modules didn't work for me. But creating a new workspace with yarn worked. I think it was an npm problem
from nx.
Related Issues (20)
- Documentation Typo in Vue Package HOT 1
- NX Remix recipe and other yarn berry (4) issues HOT 2
- Cannot disable run-many verbose logging in CI
- Creating a new NextJs Application with App Router option enabled fails to build HOT 2
- `nx release` updating lock file un-syncs lock file with package.json HOT 8
- New outputPath object structure not compatible with @angular-devkit/build-angular:extract-i18n | The "path" argument must be of type string HOT 2
- @nx/angular:app as buildTarget for @angular-devkit/build-angular:extract-i18n not extracting any messages. legacy-building works HOT 2
- nx release not pushing the changes to source-control HOT 1
- @nx/storybook doesn't support Storybook v8.0.0-rc.0 HOT 4
- ERROR: nx migrate 17 to 18 - Unable to merge project information for project.json using plugin nx/core/project-json. HOT 8
- Package-based generators doesn't work HOT 2
- vite.config.mts.timestamp files not being cleaned
- @nx/remix doesn't define package.json exports correctly
- NX build get stuck HOT 2
- An error occured while creating pruned lockfile
- Validation for required fields in custom generators is not working HOT 2
- NodeJs app with ESM enabled cannot import from shared library
- Issue with releasing changelogs in GitHub workflows (ERR_BAD_RESPONSE) HOT 10
- Self hosted NX agents
- Nx unable to run multiple cypress features simultaneously
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx.