Giter Club home page Giter Club logo

Comments (8)

ljharb avatar ljharb commented on September 12, 2024 1

(but note that if you omit peers, your dep graph is invalid and can't work)

from cli.

kchindam-infy avatar kchindam-infy commented on September 12, 2024

@saziri-arrow The typescript is installed with npm install --omit=dev because its a peer dependency of ts-node not directly a devDependency. To prevent typescript from being installed you would need to omit peer dependencies with npm install --omit=peer.
You can check the documentation here : https://docs.npmjs.com/cli/v10/commands/npm-install#omit

from cli.

kchindam-infy avatar kchindam-infy commented on September 12, 2024

@saziri-arrow As pointed by Lijarb potential issues with omitting peer dependencies. If you are sure you can do selective omission instead of omitting all peer dependencies, consider manually managing them use a post-install script in package.json.

from cli.

saziri-arrow avatar saziri-arrow commented on September 12, 2024

Hello I can't use npm install --omit=peer since I need other peerDependencies obviously.
My question is :
Why ts-node is installed with --omit=dev since it's devDependancy and It's marked as optional peerDependancy in typeorm.
Optioannal peerDependancy should only match dependancy, not devDependancy don't you think ?
While the same configuration in root package.json will not install peerDependancy with -omit=dev :

"peerDependencies": { "ts-node": "^10.9.2" }, "peerDependenciesMeta": { "ts-node": { "optional": true } }, "devDependencies": { "ts-node": "^10.9.2" },

Also if you run npm uninstall ts-node, it will keep it since it's already install with typeorm peerDependancy (package-lock.json)

from cli.

kchindam-infy avatar kchindam-infy commented on September 12, 2024

The reason ts-node is still installed even with --omit=dev is because its listed as peer dependency of typeorm. When npm installs typeorm it sees ts-node as a peer dependency and installs it, regardless of whether its also listed as a devDependency in your root package.json. The npm uninstall ts-node does not remove because its still listed as a peer dependeny of typeorm in your package-lock.json. npm sees that its still required by another package in dependency tree and keeps it installed.

optional peer dependencies:
Marked as optional in the peerDependenciesMeta field, and are meant to be installed only if the package using them is installed.

from cli.

saziri-arrow avatar saziri-arrow commented on September 12, 2024

Hello ts-node will not be installed because it is marked as optional dependancy :
Screenshot 2024-08-29 at 09 00 23
But it will be installed if I add ts-node it to my devDependancies. For you it is the correct behaviour ? Mixing devDependancies and PeerDependancies even if I write --omit=dev

from cli.

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.