Yarn: Missing modules after clean install

Created on 12 Oct 2016  ยท  14Comments  ยท  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?

BUG

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce.

Using the current package.json, after a successful install, yarn run dev returns the following:

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/olivier/workspace/network-ui/node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js:5:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
error Command failed with exit code 1.

output of yarn install

yarn install v0.15.1
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
success Saved lockfile.
โœจ  Done in 28.28s.

package.json

{
  "name": "-----",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack-dev-server --port 8001 --inline --progress --colors --host 0.0.0.0",
  },
  "homepage": "https://github.com/everflow-io/network-ui#readme",
  "dependencies": {
    "angular": "^1.5.5",
    "angular-animate": "^1.5.5",
    "angular-aria": "^1.5.5",
    "angular-cache": "^4.6.0",
    "angular-file-saver": "^1.1.2",
    "angular-material": "1.1.1",
    "angular-moment": "^1.0.0",
    "angular-ui-router": "^1.0.0-beta.3",
    "d3": "^4.1.1",
    "mime-types": "^2.1.11",
    "ngstorage": "^0.3.10"
  },
  "devDependencies": {
    "autoprefixer": "^6.5.0",
    "babel-core": "^6.9.0",
    "babel-eslint": "^6.0.4",
    "babel-loader": "^6.2.4",
    "babel-polyfill": "^6.9.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-stage-0": "^6.5.0",
    "css-loader": "^0.23.1",
    "eslint": "^2.10.2",
    "eslint-config-angular": "^0.5.0",
    "eslint-plugin-angular": "^1.0.1",
    "file-loader": "^0.8.5",
    "git-rev-sync": "^1.7.1",
    "grunt": "^1.0.1",
    "grunt-webfont": "^1.6.0",
    "html-loader": "^0.4.3",
    "json-loader": "^0.5.4",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "ng-annotate-loader": "^0.1.0",
    "ngtemplate-loader": "^1.3.1",
    "node-sass": "^3.7.0",
    "postcss-loader": "^0.13.0",
    "raw-loader": "^0.5.1",
    "request": "^2.75.0",
    "sass-loader": "^3.2.0",
    "style-loader": "^0.13.1",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.2",
    "webpack-dev-server": "^1.16.2",
    "xml2js": "^0.4.17"
  },
  "optionalDependencies": {
    "fsevents": "^1.0.14"
  }
}

yarn.lock
yarn.lock.zip

What is the expected behavior?

When I run npm install and npm run dev the script executes correctly.

Please mention your node.js, yarn and operating system version.

$ node --version
v6.7.0
$ yarn --version
0.15.1

OSX El capitan 10.11.4
``

Most helpful comment

This issue is caused by the .yarnclean file, which contains assets as a directory it removes after either the yarn install or yarn add commands complete. Commenting this directory out will prevent it from being removed.

screen shot 2017-01-24 at 7 33 04 pm

All 14 comments

I think this can relate to #782

I have the same issue where yarn does not install graceful-fs, which is a sub dependency somewhere (completely different package.json).

@OlivierBoucher #782 doesn't seem related to me...

I have this issue, too. There is graceful-fs record in yarn.lock but there is no graceful-fs in node_modules.

I ran yarn add graceful-fs and it works for me now. Not the most optimal solution but it'll get you up and running for now.

Also having this issue with graceful-fs missing from node_modules even though there is a package that depends on it.

yarn.lock file contains:

enhanced-resolve@~0.9.0:
  version "0.9.1"
  resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e"
  dependencies:
    graceful-fs "^4.1.2"
    memory-fs "^0.2.0"
    tapable "^0.1.8"

But when I build with Webpack:

$ yarn run build
yarn run v0.15.1
$ "webpack --devtool source-map"
module.js:457
    throw err;
    ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (F:\PROJECTS\app\node_modules\enhanced-resolve\lib\NodeJsInputFileSystem.js:5:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
error Command failed with exit code 1.
info Visit http://yarnpkg.com/en/docs/cli/run for documentation about this command.

+1, the same problem.

 yarn add graceful-fs

ok.

waiting for.. fixed...

For me optional dependencies seem to be missing. With the following package.json:

{
  "name": "test",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.5.8",
    "angular-animate": "1.5.8",
    "angular-aria": "1.5.8",
    "angular-mocks": "1.5.8",
    "angular-resource": "1.5.8",
    "angular-sanitize": "1.5.8",
    "angulartics": "1.2.1",
    "babel-polyfill": "6.16.0",
    "bootstrap": "3.3.7",
    "ee-bind-attr": "0.1.3",
    "ee-l20n": "1.2.0",
    "jquery": "2.2.4",
    "jquery-wheel": "0.2.2",
    "jquery.tabbable": "1.0.1",
    "lodash": "3.10.1",
    "malakh": "0.10.0-beta.3",
    "ng-l20n": "0.3.0",
    "ng-tags-input": "3.1.1",
    "pdfjs-dist": "1.6.230",
    "typeahead.js": "0.11.1"
  },
  "devDependencies": {
    "babel-core": "6.17.0",
    "babel-preset-es2015": "6.16.0",
    "bluebird": "3.4.6",
    "browserstacktunnel-wrapper": "2.0.0",
    "check-dependencies": "1.0.1",
    "connect-modrewrite": "0.9.0",
    "ee-grunt-svgstore": "0.4.1-fork.2",
    "eslint-config-mgol": "0.0.16",
    "exit": "0.1.2",
    "findup-sync": "0.4.2",
    "gitignore-to-glob": "0.2.1",
    "grunt": "1.0.1",
    "grunt-angular-templates": "1.1.0",
    "grunt-autoprefixer": "3.0.4",
    "grunt-babel": "6.0.0",
    "grunt-cli": "1.2.0",
    "grunt-contrib-clean": "1.0.0",
    "grunt-contrib-concat": "1.0.1",
    "grunt-contrib-connect": "1.0.2",
    "grunt-contrib-copy": "1.0.0",
    "grunt-contrib-cssmin": "1.0.2",
    "grunt-contrib-htmlmin": "2.0.0",
    "grunt-contrib-sass": "1.0.0",
    "grunt-contrib-uglify": "2.0.0",
    "grunt-contrib-watch": "1.0.0",
    "grunt-ddescribe-iit": "0.0.6",
    "grunt-eslint": "19.0.0",
    "grunt-file-exists": "0.1.4",
    "grunt-filerev": "2.3.1",
    "grunt-fontello": "0.3.3",
    "grunt-githooks": "0.6.0",
    "grunt-include-source": "1.0.0",
    "grunt-jsonlint": "1.1.0",
    "grunt-karma": "2.0.0",
    "grunt-merge-conflict": "0.0.2",
    "grunt-newer": "1.2.0",
    "grunt-ng-annotate": "2.0.2",
    "grunt-npmcopy": "0.1.0",
    "grunt-shell": "2.0.0",
    "grunt-usemin": "3.1.1",
    "http-proxy": "1.15.1",
    "image-size": "0.5.0",
    "isbinaryfile": "3.0.1",
    "jasmine-core": "2.5.2",
    "jit-grunt": "0.10.0",
    "json5": "0.5.0",
    "karma": "1.3.0",
    "karma-browserstack-launcher": "1.1.1",
    "karma-jasmine": "1.0.2",
    "karma-junit-reporter": "1.1.0",
    "karma-ng-json2js-preprocessor": "2.0.1",
    "l20n": "1.0.2",
    "mime": "1.3.4",
    "nodemon": "1.11.0",
    "protractor": "4.0.9",
    "replay": "2.1.2",
    "semver": "5.3.0",
    "serve-static": "1.11.1",
    "time-grunt": "1.4.0"
  },
  "optionalDependencies": {
    "grunt-contrib-imagemin": "1.0.1",
    "grunt-inline-images": "0.2.6",
    "grunt-notify": "0.4.5",
    "karma-chrome-launcher": "2.0.0",
    "karma-coverage": "1.1.1",
    "karma-firefox-launcher": "1.0.0",
    "karma-safari-launcher": "1.0.0",
    "karma-sauce-launcher": "1.0.0"
  }
}

invoking yarn doesn't install karma-firefox-launcher & probably most other optional dependencies. yarn.lock contains an entry for the package:

[email protected]:
  version "1.0.0"
  resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-1.0.0.tgz#e08af3ce42e39860c2952ea7b7eaa64d63508bdc"

Same here, but the affected subdependency is fs.realpath. Using yarn 0.17.9.

graceful-fs was installed when updating yarn to latest version 0.17.10 (#1112) .
Does it work for you as well?

I just tried it and fs.realpath is still missing with yarn 0.17.10.

having the same issue when deploying to heroku using buildpack from https://github.com/heroku/heroku-buildpack-nodejs/issues/337#issuecomment-253286196 (v0.17.10).. on local machine, it works fine, but in heroku lodash._isiterateecall doesn't get installed.. the workaround by doing yarn add [package] works, albeit not ideal..

I have a similar problem with bootstrap-sass. In this case the module is not fully missing. After the Cleaning modules step, the assets directory (where the _bootstrap.scss is located) is missing. This breakes my build because my SASS files depends on this file.

Anyone with the same problem?

This issue is caused by the .yarnclean file, which contains assets as a directory it removes after either the yarn install or yarn add commands complete. Commenting this directory out will prevent it from being removed.

screen shot 2017-01-24 at 7 33 04 pm

Was this page helpful?
0 / 5 - 0 ratings