Git Product home page Git Product logo

Comments (3)

KranzAklilu avatar KranzAklilu commented on June 12, 2024

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.

jaysoo avatar jaysoo commented on June 12, 2024

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.

KranzAklilu avatar KranzAklilu commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.