yarn icon indicating copy to clipboard operation
yarn copied to clipboard

yarn install goes to infinite loop

Open strctr opened this issue 9 years ago • 6 comments

When running yarn install it goes to infinite loop. Yarn installed globally. Node v7.1.0

image

strctr avatar Dec 23 '16 11:12 strctr

Do you have anything defined in the scripts section of your package.json?

hawkrives avatar Dec 23 '16 19:12 hawkrives

Yes.

"scripts": {
        "install": "yarn install",
        "task": "./node_modules/.bin/gulp --gulpfile ./config/tasks.js --cwd .",
        "clean": "./node_modules/.bin/gulp --gulpfile ./config/tasks.js --cwd . clean",
        "webpack": "webpack"
    }

I call npm run install from other build system (sbt) to install js deps when resolving dependencies for main project. If I remove "install": "yarn install" -- everything is OK. Hmm, where is the problem here? I can't use install name for npm script?

strctr avatar Dec 24 '16 12:12 strctr

You can use install as the name for npm scripts, but if you look at the docs you'll see that install is just an alias for post install. What's happening here is yarn installs the packages, then the install script (or postinstall) gets called. Which does the same thing.

You really don't need a script that says yarn install since you could just type that in your terminal with yarn installed globally.

CaffeinatedCM avatar Dec 28 '16 22:12 CaffeinatedCM

I have a postinstall script that calls yarn install. I am trying to migrate from npm. I had this before:

    "postinstall": "npm install --no-save [email protected] --runtime=electron --target=1.7.9"

which works great: npm install is followed by the install of grpc then everything is done, no infinite loop.

I change it to:

    "postinstall": "yarn install --no-save [email protected] --runtime=electron --target=1.7.9"

and then yarn install goes to an infinite loop, unlike npm.

So, after yarn install is finished, how do I automatically run another install?

trusktr avatar Jun 21 '18 22:06 trusktr

@trusktr did you manage to workaround this issue? I am facing the same error.

HannanShaikYara avatar Dec 11 '18 02:12 HannanShaikYara

If anyone still encounters this issue, I was able to fix it with --ignore-scripts:

    "scripts": {
        "postinstall": "yarn install --ignore-scripts"
    },

Yarn version is 1.15.2

debugmaster avatar Apr 04 '19 13:04 debugmaster