yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

yarn 1.6.0 is broken for firebase@4.6.1 package #5775

Open esprehn opened 6 years ago

esprehn commented 6 years ago

Do you want to request a feature or report a bug? Bug

What is the current behavior?

yarn 1.5.1 works fine for us, yarn 1.6.0 fails with:

error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Checkouts/grasshopper/packages/common/node_modules/@firebase/app/node_modules/@firebase'".

If the current behavior is a bug, please provide the steps to reproduce. We have a setup using lerna of a monorepo with multiple packages/ using yarn workspaces. When doing yarn update, install or add with yarn 1.6.0 it fails with the above error on the package that uses firebase 4.6.1

Some of the nested packages use firebase 4.6.1 while others use 4.13.1, it seems like firebase@4.6.1 might be incompatible with yarn?

What is the expected behavior? Installs successfully like yarn 1.5.1 did.

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

node v8.9.4, OS X 10.13.3

Error Log: https://gist.github.com/esprehn/d94eef99faf706b8af23db60126519ee

rally25rs commented 6 years ago

I tried the same package.json that is specified in your error log and didn't have an errors.

~/Projects/yarn-test 🐒   yarn
yarn install v1.6.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "firebase-admin > @firebase/database@0.2.2" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase-admin > @firebase/database > @firebase/database-types@0.2.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/functions@0.1.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/storage@0.1.9" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/messaging@0.2.4" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/firestore@0.4.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/functions > @firebase/messaging-types@0.1.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/storage > @firebase/storage-types@0.1.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/firestore > @firebase/firestore-types@0.3.0" has unmet peer dependency "@firebase/app-types@0.x".
warning "firebase > @firebase/auth > @firebase/auth-types@0.2.1" has unmet peer dependency "@firebase/app-types@0.x".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 22.79s.

~/Projects/yarn-test 🐒   cat package.json
{
  "name": "include-common",
  "description": "Include common code.",
  "version": "1.0.0",
  "author": "include@google.com",
  "private": true,
  "scripts": {
  },
  "dependencies": {
    "d3-format": "1.2.0",
    "escodegen": "1.8.1",
    "esprima": "4.0.0",
    "esquery": "0.4.0",
    "estraverse": "4.2.0",
    "firebase-admin": "5.12.0",
    "firebase-safekey": "0.1.9",
    "firebase": "4.13.1",
    "form-data": "2.3.2",
    "lodash": "4.17.4",
    "moment": "2.20.1",
    "node-fetch": "2.1.2",
    "semver": "5.5.0",
    "tslib": "1.7.1"
  },
  "//": "NOTE: babel-plugin-transform-object-assign is needed for compiling into webview.",
  "devDependencies": {
    "@types/d3-format": "1.2.0",
    "@types/escodegen": "0.0.6",
    "@types/esprima": "2.1.33",
    "@types/estraverse": "0.0.6",
    "@types/estree": "0.0.38",
    "@types/form-data": "2.2.1",
    "@types/lodash": "4.14.86",
    "@types/node-fetch": "1.6.9",
    "@types/semver": "5.5.0",
    "babel-plugin-transform-object-assign": "6.22.0",
    "babel-preset-env": "1.6.1",
    "firebase-admin-mock": "0.0.10",
    "source-map-support": "0.5.3"
  }
}

The path from your error message certainly looks suspect: '/Checkouts/grasshopper/packages/common/node_modules//node_modules/@firebase' the node_modules//node_modules is likely the issue. Can you run with --verbose and see if there is any additional info there? During what phase of the yarn install does this error happen? If you run with --ignore-scripts does the error go away? If so, then it's probably a custom install script in firebase that is causing an issue.

rally25rs commented 6 years ago

I also did it as a workspace package, since that's closer to your actual setup:

~/Projects/yarn-test 🐒   cat package.json
{
  "name": "yarn-test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "private": true,
  "workspaces": [
    "packages/*"
  ]
}

~/Projects/yarn-test 🐒   cat packages/common/package.json
{
  "name": "include-common",
  "description": "Include common code.",
  "version": "1.0.0",
  "author": "include@google.com",
  "private": true,
  "scripts": {
  },
  "dependencies": {
    "d3-format": "1.2.0",
    "escodegen": "1.8.1",
    "esprima": "4.0.0",
    "esquery": "0.4.0",
    "estraverse": "4.2.0",
    "firebase-admin": "5.12.0",
    "firebase-safekey": "0.1.9",
    "firebase": "4.13.1",
    "form-data": "2.3.2",
    "lodash": "4.17.4",
    "moment": "2.20.1",
    "node-fetch": "2.1.2",
    "semver": "5.5.0",
    "tslib": "1.7.1"
  },
  "//": "NOTE: babel-plugin-transform-object-assign is needed for compiling into webview.",
  "devDependencies": {
    "@types/d3-format": "1.2.0",
    "@types/escodegen": "0.0.6",
    "@types/esprima": "2.1.33",
    "@types/estraverse": "0.0.6",
    "@types/estree": "0.0.38",
    "@types/form-data": "2.2.1",
    "@types/lodash": "4.14.86",
    "@types/node-fetch": "1.6.9",
    "@types/semver": "5.5.0",
    "babel-plugin-transform-object-assign": "6.22.0",
    "babel-preset-env": "1.6.1",
    "firebase-admin-mock": "0.0.10",
    "source-map-support": "0.5.3"
  }
}
~/Projects/yarn-test 🐒   yarn
yarn install v1.6.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase-admin > @firebase/database@0.2.2" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/functions@0.1.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/messaging@0.2.4" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/firestore@0.4.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/storage@0.1.9" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase-admin > @firebase/database > @firebase/database-types@0.2.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/functions > @firebase/messaging-types@0.1.3" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/firestore > @firebase/firestore-types@0.3.0" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/auth > @firebase/auth-types@0.2.1" has unmet peer dependency "@firebase/app-types@0.x".
warning "workspace-aggregator-e54930cc-a95b-4916-bec9-19dd4d221623 > include-common > firebase > @firebase/storage > @firebase/storage-types@0.1.3" has unmet peer dependency "@firebase/app-types@0.x".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 9.58s.
esprehn commented 6 years ago

Interesting, I'll make try to make a minimal repro to share. Thanks for looking into this!

Jekiwijaya commented 6 years ago

I got same error with yarn v1.6.0 too with firebase ^3.3.2. My project structure using lerna, and when run lerna bootstrap, client yarn install trigger an error.

My CI also trigger same error. But it works with yarn version 1.5.1

Node: v8.11.1 OSX 10.13.3 yarn-error.log

nickarora commented 6 years ago

Just reporting that we experienced the same issue on a large mono-repo using the latest version of yarn (1.12). (No lerna). The issue was unrelated to firebase, but was triggered on jest and ts-jest. The error was always took the following form:

ENOENT: no such file or directory, lstat : /App/packages/package1/node_modules/submodule

The error only occurred when a new package was added using yarn workspace <packagename> add <some-module>. It did not matter if I cleared the yarn cache prior to running the above command; it did not fix the issue.

Deleting all node_modules directories, running yarn cache clean, allowed the install to complete successfully. Downgrading to yarn 1.5.1 also eliminated the error.