Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot globally install any package: "expected manifest" #1824

Closed
brw opened this issue Nov 14, 2016 · 20 comments
Closed

Cannot globally install any package: "expected manifest" #1824

brw opened this issue Nov 14, 2016 · 20 comments
Labels

Comments

@brw
Copy link

brw commented Nov 14, 2016

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

What is the current behavior?
Output when trying to install create-react-app as it's the example here.

yarn global v0.17.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error An unexpected error occurred: "expected manifest".
info If you think this is a bug, please open a bug report with the information provided in "/home/bas/.config/yarn/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

From the log:

Trace:
  Invariant Violation: expected manifest
      at invariant (/home/bas/n/lib/node_modules/yarn/node_modules/invariant/invariant.js:42:15)
      at PackageResolver.getStrictResolvedPattern (/home/bas/n/lib/node_modules/yarn/lib/package-resolver.js:401:5)
      at GlobalAdd.maybeOutputSaveTree (/home/bas/n/lib/node_modules/yarn/lib/cli/commands/global.js:185:38)
      at /home/bas/n/lib/node_modules/yarn/lib/cli/commands/add.js:162:19
      at Generator.next (<anonymous>)
      at step (/home/bas/n/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
      at /home/bas/n/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13

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

  • Try to globally install any package (e.g.: yarn global add create-react-app)

What is the expected behavior?
Should globally install the package.

Please mention your node.js, yarn and operating system version.
Node: 7.1.0
Yarn: 0.17.0
OS: Antergos Linux release 16.6 (ISO-Rolling), Linux version 4.8.7-1-ARCH

@eisisig
Copy link

eisisig commented Nov 14, 2016

Same error with jscodeshift

yarn global add jscodeshift

Node: 7.1.0
yarn: 0.17.0
macOS 10.12.2

@vitorgalvao
Copy link

Please mention your node.js, yarn and operating system version.
Node: 7.1.0
Yarn: 0.17.0
OS: Antergos Linux release 16.6 (ISO-Rolling), Linux version 4.8.7-1-ARCH

Can confirm on macOS 10.11.6 as well (same versions for everything else).

@onemen
Copy link

onemen commented Nov 14, 2016

Fix Invariant Violation: expected manifest from GlobalAdd (regressed by #1757)

diff --git a/src/cli/commands/global.js b/src/cli/commands/global.js
--- a/src/cli/commands/global.js
+++ b/src/cli/commands/global.js
@@ -17,7 +17,7 @@ import * as fs from '../../util/fs.js';

 class GlobalAdd extends Add {
   maybeOutputSaveTree(): Promise<void> {
-    for (const pattern of this.args) {
+    for (const pattern of this.addedPatterns) {
       const manifest = this.resolver.getStrictResolvedPattern(pattern);
       ls(manifest, this.reporter, true);
     }

@jessb321
Copy link

Can't install any package globally here either. macOS 10.12.1.

@mDibyo
Copy link

mDibyo commented Nov 15, 2016

Same problem on Ubuntu (as expected from the macOS reports above)
yarn global add webpack

@calebeby
Copy link

calebeby commented Nov 15, 2016

Same thing here. yarn global add coffee-script on c9.io

@domino14
Copy link

yarn global add gulp-cli doesn't work on circleCI

@calebeby
Copy link

calebeby commented Nov 15, 2016

OK. Was on node 4.6.1, with nvm, and switched to 7.1.0 and now it works. Never mind, it actually doesn't. 😭

@Repox
Copy link

Repox commented Nov 15, 2016

Also confirming the issue.

@flemming-steinson
Copy link

Same issue here

@timoxley
Copy link
Contributor

timoxley commented Nov 15, 2016

Workaround

If you want a workaround right now for installing global packages, use @latest after the package name, e.g.

yarn global add webpack@latest

This works with any exact version, dist-tag or any semver range:

yarn global add webpack@latest # equivalent to: yarn global add webpack
yarn global add [email protected] # explicit version
yarn global add [email protected] # prerelease version
yarn global add webpack@beta # a custom dist-tag published for webpack
yarn global add webpack@^1.13.1 # semver range, will install 1.13.3
yarn global add webpack@\* # will also install 1.13.3

As far as I can tell, you just need an @ plus something/anything semver can parse.

@iraklisg
Copy link

same issue

@VincentChataignier
Copy link

Same issue, but if I install grunt-cli package with yarn global add grunt-cli@latest, the command grunt was not found and not linked in /usr/bin folder.

@arxpoetica
Copy link

nodemon is also not linked using @latest

@simonas-notcat
Copy link

Same issue with yarn global add code-push-cli

arxpoetica referenced this issue in Homebrew/homebrew-core Nov 15, 2016
Closes #6915.

Signed-off-by: Mike McQuaid <[email protected]>
@arxpoetica
Copy link

arxpoetica commented Nov 15, 2016

For anyone who needs to rollback while waiting for this fix, first uninstall the current version of yarn and then just do:

Make sure to uninstall and then reinstall global dependencies to include bin linking.

yarn global remove ...
yarn global add ...

@iraklisg
Copy link

@arxpoetica could you please provide more details about the following?

Make sure to uninstall and then reinstall global dependencies to include bin linking.
yarn global remove ...
yarn global add ...

because after doing a rollback to yarn 0.16.1, I get the following error when running yarn

/usr/local/lib/node_modules/yarn/bin/yarn.js:47
      throw err;
      ^

Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/yarn/updates/0.17.0/lib/cli/index.js'
    at Object.fs.openSync (fs.js:557:18)
    at Object.fs.readFileSync (fs.js:467:33)
    at Object.Module._extensions..js (module.js:581:20)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/yarn/bin/yarn.js:39:22)
    at Module._compile (module.js:573:32)

@arxpoetica
Copy link

@iraklisg I'm not sure I'll be much help, but good news, they've releases a fix in 0.17.2, so you can install the latest version of Yarn, and should be good to go.

https://github.com/yarnpkg/yarn/releases/tag/v0.17.2

@iraklisg
Copy link

@arxpoetica, indeed, I have updated yarn to v0.17.3 and everything seems to work fine thus far

@shuiRong
Copy link

shuiRong commented Dec 15, 2020

like #1824 (comment) said.
I can run this yarn global add webpack@latest well, but not this yarn global add npm@latest

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests