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

Can't remove global packages #1917

Closed soredake closed 7 years ago

soredake commented 8 years ago

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

What is the current behavior?

$ yarn global remove jpm
yarn global v0.17.3
[1/2] Removing module jpm...
error This module isn't specified in a manifest.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce. yarn global add jpm yarn global remove jpm

What is the expected behavior? Successfully removed global package.

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

iredchuk commented 8 years ago

Works for me with yarn 0.17.4, node 7.1.0 and macOS 10.12.1

soredake commented 7 years ago

Still can't in 0.19.0.

GYK90 commented 7 years ago

it works for me with Windows 10 and yarn 0.18.1

Murphydbuffalo commented 7 years ago

Doesn't work for me on 0.20.3, running Ubuntu 14.04, Node 6.2.1

DiederikvandenB commented 7 years ago

I have the same issue, macOS, everything updated.

DominoPivot commented 7 years ago

Same issue running yarn 0.21.3 on node v7.7.2 on the linux subsystem for Windows 10.

soredake commented 7 years ago

I can remove the global package on 0.21.3 if i do cd ~/.config/yarn/global.

MangiDu commented 7 years ago

maybe another package is dependent on the one you want to remove. I got a same situation when yarn global remove docsify,then I found docsify-cli was dependent on docsify, it worked when I do yarn global remove docsify-cli.

DaniGuardiola commented 6 years ago

In my case the module had a scope, so although the binary has the same name as the package, yarn global remove module didn't work, because I had to put the scope in it, like this: yarn global remove @scope/module. Just like when installing (yarn global add @scope/module).

brunolemos commented 6 years ago

I just had this problem, turns out it was something wrong with the yarn global manifest. I was able to delete all other modules, so my manifest got empty and now it's fixed.

Ayanrocks commented 6 years ago

Did it fixed. Running on ubuntu 16.04. I got this error

yarn global remove live-server yarn global v1.6.0 [1/2] Removing module live-server... error This module isn't specified in a manifest. info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

vintprox commented 6 years ago

It still requires to have dependency specified in the manifest to remove global one.

yarn v1.7.0

EzeBernardine commented 6 years ago

my is not working node 8.11.2 yarn 1.7.0 OS linux

hrldcpr commented 6 years ago

I encountered this error, and it was due to the executable having a different name than the module.

Specifically, yarn global remove parcel failed but yarn global remove parcel-bundler worked.

boda-sh commented 6 years ago

I had the following errors when I tried to remove google cloud functions emulator from yarn global:

info "@google-cloud/functions-emulator@1.0.0-beta.5" has binaries:
   - functions
   - functions-emulator

In this case, I wasn't sure which <NAME> I should put into yarn global remove <NAME>.

So I just looked up at the getting started instructions on how to add it in the first place, which is yarn global add @google-cloud/functions-emulator, then it's becomes clear that yarn global remove @google-cloud/functions-emulator is the right solution, and it worked.

Although I have to say it was unclear to get this right immediately from the yarn error messages.

xiaodeaux commented 5 years ago

Still having this error.

yarn global list
yarn global v1.12.3
info "@vue/cli@3.2.1" has binaries:
   - vue
Done in 0.80s.

yarn global remove @vue/cli@latest
yarn global v1.12.3
[1/2] Removing module @vue/cli@latest...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

EDIT The solution seems to be to remove the @latest or @[Whatever version is installed] from the package name.

WuglyakBolgoink commented 5 years ago

@xiaodeaux doesn't work on me:

1)

$ yarn global list                                                                                                                                                                               

Output:

yarn global v1.15.2
info "ts-node@7.0.1" has binaries:
   - ts-node
✨  Done in 0.09s.

2) Remove with version

$ sudo yarn global remove ts-node@7.0.1 --force

Output:

yarn global v1.15.2
[1/2] 🗑  Removing module ts-node@7.0.1...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

3) Remove without version

$ sudo yarn global remove ts-node --force                                                                                                                                                       

Output:

yarn global v1.15.2
[1/2] 🗑  Removing module ts-node...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
hrldcpr commented 5 years ago

@WuglyakBolgoink have you tried running the remove command without sudo?

Might not help, but sometimes commands run under sudo receive different environment variables, so might be worth a shot…

(You can also try running the list command with sudo as another bit of debugging)

tuomohopia commented 5 years ago

I'm experiencing this too on WIN10, yarn v.1.15.2.

Error message:

yarn global v1.15.2
[1/2] Removing module detox...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
hrldcpr commented 5 years ago

@tuomohopia just a guess but have you tried removing detox-cli instead?

tuomohopia commented 5 years ago

@hrldcpr yes, absolutely right, how silly of me to trip on that. Thanks!

bucketclan commented 5 years ago

I still feel the error message could be improved.

chpio commented 4 years ago

yeah it's just a bad error message.

I tried removing discify (yarn global remove discify) and got the message. But the actual package name of discify is disc. Using the real package name worked as intended :D

deepakaggarwal7 commented 4 years ago

I'm experiencing this too on WIN10, yarn v.1.15.2.

Error message:

yarn global v1.15.2
[1/2] Removing module detox...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

add sudo behind command and it should work sudo yarn global remove detox --force

towry commented 3 years ago

Be sure the <name> is correct.

For example, if you install a module by this: yarn global add @abc-scope/a-module, you must remove it by using the same <name>: yarn global remove @abc-scope/a-module.

So make sure the <name> is correct. you can check it by running yarn global list.

magicianlib commented 3 years ago

Be sure the <name> is correct.

For example, if you install a module by this: yarn global add @abc-scope/a-module, you must remove it by using the same <name>: yarn global remove @abc-scope/a-module.

So make sure the <name> is correct. you can check it by running yarn global list.

You Are Right :)

It's on my Mac:

$ yarn global list
yarn global v1.22.17
info "@vue/cli@4.5.13" has binaries:
   - vue
info "clipboard-cli@2.0.1" has binaries:
   - clipboard
info "create-umi@0.24.1" has binaries:
   - create-umi
info "gitbook-cli@2.3.2" has binaries:
   - gitbook
✨  Done in 1.35s.

I tried to execute the order:

$ yarn global remove gitbook
# or
$ yarn global remove gitbook-cli@2.3.2

I got an error:

error This module isn't specified in a package.json file.

Because the real name of gitbook should be gitbook-cli, SO:

$ yarn global remove gitbook-cli
yarn global v1.22.17
[1/2] 🗑  Removing module gitbook-cli...
[2/2] 🔨  Regenerating lockfile and installing missing dependencies...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[-/6] ⠁ waiting...
[-/6] ⠂ waiting...
success Uninstalled packages.
✨  Done in 23.74s.

Thank You Very Much :) :) :) :)

krymel commented 1 year ago

Ooof, just realized that when you yarn global remove ts-node and you finally end up having it removed, so that it tells you error This module isn't specified in a package.json file. -- you can still whereis ts-node and it tells you...

/Users/aron/.config/yarn/global/node_modules/.bin/ts-node

So you cd into that folder and ls -la

lrwxr-xr-x 1 krymel staff 48 10 Jan 00:22 ts-node -> ../@vercel/node/node_modules/ts-node/dist/bin.js

Oh thank you, yarn creates a symlink in cache because globally installed @vercel/node needs it. So I still have ts-node installed globally. If I remove it, I break @vercel/node, if I don't, I have the wrong version installed on my machine.

What invariant of hell am I enjoying right now? Can we call that one global dependency hell? Just for sweetening my pain? xD

geoidesic commented 7 months ago

Same issue in 2024 I used to love yarn. I'm beginning to hate it.