Do you want to request a feature or report a bug?
Bug (works prior 1.0.0, tested to work on 0.27)
What is the current behavior?
yarn install --flat fails
returns Invariant Violation: expected manifest
If the current behavior is a bug, please provide the steps to reproduce.
create a package.json with this:
{
"name": "test",
"private": true,
"version": "0.0.1",
"devDependencies": {
"standard": "^10.0.3"
},
"resolutions": {
"doctrine": "2.0.0",
"strip-ansi": "4.0.0",
"ansi-regex": "3.0.0",
"acorn": "5.1.2",
"string-width": "2.1.1",
"is-fullwidth-code-point": "2.0.0",
"minimist": "1.2.0",
"find-up": "2.1.0",
"path-exists": "3.0.0"
}
}
type yarn install --flat and it will not work.
If you removed the resolutions, it will work.
What is the expected behavior?
It should work
Please mention your node.js, yarn and operating system version.
Node 6.11.2, yarn 1.0.0 Ubuntu
Here's the yarn-error.log
Arguments:
/home/tjmonsi/.nvm/versions/node/v6.11.2/bin/node /home/tjmonsi/.nvm/versions/node/v6.11.2/bin/yarn install --flat
PATH:
/home/tjmonsi/.nvm/versions/node/v6.11.2/bin:/home/tjmonsi/bin:/home/tjmonsi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/tjmonsi/.rvm/bin:/home/tjmonsi/.rvm/bin
Yarn version:
1.0.0
Node version:
6.11.2
Platform:
linux x64
npm manifest:
{
"name": "test",
"private": true,
"version": "0.0.1",
"devDependencies": {
"standard": "^10.0.3"
},
"resolutions": {
"doctrine": "2.0.0",
"strip-ansi": "4.0.0",
"ansi-regex": "3.0.0",
"acorn": "5.1.2",
"string-width": "2.1.1",
"is-fullwidth-code-point": "2.0.0",
"minimist": "1.2.0",
"find-up": "2.1.0",
"path-exists": "3.0.0"
}
}
yarn manifest:
No manifest
Lockfile:
No lockfile
Trace:
Invariant Violation: expected manifest
at invariant (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:1365:15)
at PackageResolver.getStrictResolvedPattern (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:58930:5)
at PackageResolver.resolveToResolution (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:59139:39)
at /home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:59026:25
at next (native)
at step (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:92:30)
at /home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:110:14
at Promise.F (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:29284:28)
at /home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:89:12
at PackageResolver.find (/home/tjmonsi/.nvm/versions/node/v6.11.2/lib/node_modules/yarn/lib/cli.js:59067:7)
Hi @tjmonsi, thanks for reporting! It looks like the bug is happening due to a missing lockfile. The temporary work around is to run yarn in normal mode to generate a lockfile then run yarn --flat again. I'll be looking into a PR for actual fix very soon.
I am also using Yarn v1.0.1 and flat. I get the same error. If I delete the lock file and the resolutions from package.json, I can then do a yarn install and specify my resolutions. However, if I then try to add a package (in this case yarn add css-loader --dev), I still get the An unexpected error occurred: "expected manifest" error.
@kaylieEB Actually, it installs when there's no lockfile. But when there is a lockfile and/or a resolutions attribute in package.json, it fails. This is weird.
I manage to just make it work by removing that module above in the example: "standard"
So it might help you guys.
Actually did a bit more digging, and it turns out it had to do with nested dependency, i.e. strip-ansi depends on ansi-regex and because it tries to resolve the latter as a resolution when it hasn't been resolved yet, it's throwing an error. Working PR https://github.com/yarnpkg/yarn/pull/4372.
Thanks :) yey :)
@kaylieEB any update yet? this is blocking us at the moment...
yup @BYK will be reviewing it tomorrow. Sorry for the delay!
Cool, thanks alot @kaylieEB
do you know when you guys will release a new version with this fix in it?
do you know when you guys will release a new version with this fix in it?
In a matter of days. In the meantime you can try the nightlies https://yarnpkg.com/en/docs/nightly
Just my two cents.
It happens I can reproduce this bug when I have 2 or more packages declared in the resolutions object in package.json, but with only 1 declaration it works fine.
This will throw error An unexpected error occurred: "expected manifest".:
"resolutions": {
"dmd": "3.0.3",
"cache-point": "0.4.0"
}
This will work fine:
"resolutions": {
"cache-point": "0.4.0"
}
@danikaze this should be solved on master. Can you try with one of the latest nightlies: https://yarnpkg.com/en/docs/nightly
Most helpful comment
I am also using Yarn v1.0.1 and flat. I get the same error. If I delete the lock file and the resolutions from package.json, I can then do a
yarn installand specify my resolutions. However, if I then try to add a package (in this caseyarn add css-loader --dev), I still get theAn unexpected error occurred: "expected manifest"error.