Yarn: Package install fails on first try, success on second try consistently for many package

Created on 12 Oct 2016  路  11Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Report a possible bug

What is the current behavior?
When I run yarn add imagemin-svgo I get the below error

PS D:\Projects\test\angular2test> yarn add imagemin-svgo
yarn add v0.15.1
warning [email protected]: "dependencies" has dependency "gulp-imagemin" with range "^3.0.3" that collides with a dependency in "devDependencies" of the same name with version "3.0.3"
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
warning [email protected]: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
error ENOENT: no such file or directory, open 'D:\Projects\test\angular2test\node_modules\@types\angular\index.d.ts'
    at Error (native)
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

and the above specified file is present in node_modules and it actually has nothing to do with imagemin-svgo now if I run the add command again it works

PS D:\Projects\test\angular2test> yarn add imagemin-svgo                                                                                                                                  
yarn add v0.15.1                                                                                                                                                                          
warning [email protected]: "dependencies" has dependency "gulp-imagemin" with range "^3.0.3" that collides with a dependency in "devDependencies" of the same name with version "3.0.3"
[1/4] Resolving packages...                                                                                                                                                               
[2/4] Fetching packages...                                                                                                                                                                
warning [email protected]: The platform "win32" is incompatible with this module.                                                                                                           
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.                                                                          
warning [email protected]: The engine "rhino" appears to be invalid.                                                                                                                        
warning [email protected]: The engine "rhino" appears to be invalid.                                                                                                                           
warning [email protected]: The engine "rhino" appears to be invalid.                                                                                                                           
[3/4] Linking dependencies...                                                                                                                                                             
[4/4] Building fresh packages...                                                                                                                                                          
success Saved lockfile.                                                                                                                                                                   
success Saved 1 new dependency                                                                                                                                                            
鈹斺攢 [email protected]                                                                                                                                                                    
Done in 81.15s.                                                                                                                                                                           

The below is the package.json in the folder

{
  "name": "angular-2-test",
  "version": "0.0.0",
  "description": "Description for angular2test",
  "private": true,
  "cacheDirectories": [
    "node_modules",
    "src/main/webapp/bower_components"
  ],
  "dependencies": {
    "@angular/common": "2.0.1",
    "@angular/compiler": "2.0.1",
    "@angular/core": "2.0.1",
    "@angular/forms": "2.0.1",
    "@angular/http": "2.0.1",
    "@angular/platform-browser": "2.0.1",
    "@angular/platform-browser-dynamic": "2.0.1",
    "@angular/upgrade": "2.0.1",
    "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.7",
    "angular-ui-router": "1.0.0-beta.3",
    "core-js": "2.4.1",
    "gulp-imagemin": "^3.0.3",
    "imagemin-gifsicle": "^5.1.0",
    "imagemin-jpegtran": "^5.0.2",
    "imagemin-optipng": "^5.2.1",
    "imagemin-svgo": "^5.2.0",
    "jquery": "3.1.0",
    "ng2-translate": "^3.1.0",
    "ng2-webstorage": "1.3.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.27",
    "ui-router-ng1-to-ng2": "1.0.15",
    "ui-router-ng2": "1.0.0-beta.3",
    "ui-router-visualizer": "2.0.11",
    "zone.js": "0.6.23"
  },
  "devDependencies": {
    "@types/angular": "1.5.16",
    "@types/angular-animate": "1.5.5",
    "@types/angular-mocks": "1.5.5",
    "@types/jasmine": "2.2.34",
    "angular": "1.5.8",
    "bower": "1.7.9",
    "browser-sync": "2.15.0",
    "del": "2.2.2",
    "eslint-config-angular": "0.5.0",
    "eslint-plugin-angular": "1.3.1",
    "event-stream": "3.3.4",
    "generator-jhipster": "3.6.1",
    "gulp": "3.9.1",
    "gulp-angular-templatecache": "2.0.0",
    "gulp-autoprefixer": "3.1.1",
    "gulp-changed": "1.3.2",
    "gulp-cssnano": "2.1.2",
    "gulp-eslint": "3.0.1",
    "gulp-flatten": "0.3.1",
    "gulp-footer": "1.0.5",
    "gulp-htmlmin": "2.0.0",
    "gulp-if": "2.0.1",
    "gulp-imagemin": "3.0.3",
    "gulp-inject": "4.1.0",
    "gulp-ng-annotate": "2.0.0",
    "gulp-ng-constant": "1.1.0",
    "gulp-notify": "2.2.0",
    "gulp-plumber": "1.1.0",
    "gulp-rename": "1.2.2",
    "gulp-replace": "0.5.4",
    "gulp-rev": "7.1.2",
    "gulp-rev-replace": "0.4.3",
    "gulp-sourcemaps": "1.6.0",
    "gulp-tslint": "2.0.0",
    "gulp-typescript": "3.0.1",
    "gulp-uglify": "2.0.0",
    "gulp-useref": "3.1.2",
    "jasmine-core": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-coverage": "1.1.1",
    "karma-jasmine": "1.0.2",
    "karma-junit-reporter": "1.1.0",
    "karma-phantomjs-launcher": "1.0.2",
    "karma-script-launcher": "1.0.0",
    "lazypipe": "1.0.1",
    "lodash": "4.15.0",
    "main-bower-files": "2.13.1",
    "map-stream": "0.0.6",
    "phantomjs-prebuilt": "2.1.12",
    "proxy-middleware": "0.15.0",
    "run-sequence": "1.2.2",
    "typescript": "^2.0.3",
    "xml2js": "0.4.17",
    "yargs": "5.0.0"
  },
  "engines": {
    "node": "^4.3"
  },
  "scripts": {
    "test": "gulp test",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  }
}

This happens for many libs I tried (imagemin-svgo, imagemin-jpegtran, imagemin-optipng, imagemin-gifsicle)
If the current behavior is a bug, please provide the steps to reproduce.

Install any of the lib (imagemin-svgo, imagemin-jpegtran, imagemin-optipng, imagemin-gifsicle) with the above given package.json on the folder
What is the expected behavior?
Install the lib first time without error
Please mention your node.js, yarn and operating system version.
node: v5.50
os: windows 10
yarn: 0.15.1

triaged

Most helpful comment

I was still able to reproduce the issue with the latest versions.
Note that I was using lerna in case the parallelism has something to do with it.

I tried:

  • 0.18
  • 0.21.3
  • 0.23.0-20170308.0112

I almost certain is a race condition because I got different errors each time, couple of examples:

  • ENOENT: no such file or directory, open
  • NpmUtilities.installInDir ("./packages/babel-plugin-transform-", ["eslint@^3.16.1","mocha@^3.2.0","power-assert@^1....) (was trying to do yarn install in one of the pkg)

Running yarn twice seems to always succeed.

All 11 comments

I have the same, or similar issue. We have a CI builder that we tried yarn on, and it does a fresh install each time it builds (cache is used though). I receive an error like this for seemingly randomly picked packages (race condition, I imagine):

error https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz: ENOENT: no such file or directory, open 'C:\Users\CI_USR\AppData\Local\Yarn\npm-isarray-1.0.0\.yarn-tarball.tgz'

Browsing to that directory, though, you can see the file is there.

Note that we have 5 yarn installs going on in parallel (which is why we wanted to try yarn, since npm has occasional race condition issues as well).

Node 6.60
yarn 0.15.1
Windows Server 2008

Same issue here (windows 7)

Confirming ... I'm on Windows 10.

Seeing the same thing here as well. It's the only thing stopping me from being able to use Yarn.

Still an issue in yarn v0.17.10.

I'm seeing the same issue with ENOENT on package,json the first subfolder in @types which is the first subfolder in node_modules.

I have the same problem as @dougmartin , it always throws this error for me

error ENOENT: no such file or directory, open 'C:\Users\Documents\programming-projects\ProjectName\public\node_modules\@types\react\index.d.ts'

@Arrow7000 This has resolved itself for me when I upgraded yarn. I'm now running 0.19.1 and I no longer have the issue.

@dougmartin I didn't even realise I was running an old version. Thanks!

I was still able to reproduce the issue with the latest versions.
Note that I was using lerna in case the parallelism has something to do with it.

I tried:

  • 0.18
  • 0.21.3
  • 0.23.0-20170308.0112

I almost certain is a race condition because I got different errors each time, couple of examples:

  • ENOENT: no such file or directory, open
  • NpmUtilities.installInDir ("./packages/babel-plugin-transform-", ["eslint@^3.16.1","mocha@^3.2.0","power-assert@^1....) (was trying to do yarn install in one of the pkg)

Running yarn twice seems to always succeed.

The issue above should have been fixed around 0.19.
@diervo, please open a new issue with repro steps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

catkins picture catkins  路  3Comments

mnpenner picture mnpenner  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments

davidmaxwaterman picture davidmaxwaterman  路  3Comments

chiedo picture chiedo  路  3Comments