Yarn: npm rebuild [package-name] equivalent

Created on 17 Oct 2016  路  9Comments  路  Source: yarnpkg/yarn

Hi,

Is the equivalent for npm rebuild node-sass command? I'd like to rebuils that package depending on the environment it's used. How can i achieve it in yarn. Is running yarn add node-sass does the trick of reinstalling already installed package?

Most helpful comment

Don't +1 issues. GitHub adding reactions for a reason. The equivalent command is:

$ yarn install --force

All 9 comments

There's a related ticket open in the website project to document the rebuild equivalent there:
https://github.com/yarnpkg/website/issues/192

+1

+1

Don't +1 issues. GitHub adding reactions for a reason. The equivalent command is:

$ yarn install --force

I'm confused:

Running 'docker exec -it web_11 yarn install --force node-sass ...
yarn install v0.16.0
error `install` has been replaced with `add` to add new dependencies. Run "yarn add node-sass" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Which one is it now ?

Upate: it looks like a simple yarn add node-sass works fine. Is there a difference between npm install --force <pkg> and yarn add <pkg> behind the scenes, that we should be aware of ?

@dudeinthemirror As the docs [1] [2], add is for adding a new dependency, while install is for installing _all_ dependencies. Trying to install a single package doesn't make sense with yarn. The docs show that the add commands take a package name argument, while the install commands don't, since they work on _all_ dependencies.

  1. https://yarnpkg.com/en/docs/cli/install
  2. https://yarnpkg.com/en/docs/cli/add

Ah, got it. Just started implementing yarn in our project today, so total greenhorn still :) Thanks much @markstos for the info !

For anyone visiting this old thread, this worked for me:

yarn add --force node-sass

Sadly, yarn install --force does not seem to have the desired effect when using workspaces.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baptistelebail picture baptistelebail  路  3Comments

davidmaxwaterman picture davidmaxwaterman  路  3Comments

jviotti picture jviotti  路  3Comments

sebmck picture sebmck  路  3Comments

chiedo picture chiedo  路  3Comments