How to remove a Yeoman generator - yeoman

I accidentally installed a generator that I don't want.
I can't find any method to remove it.
What should I do to accomplish this?

Generators are just normal npm modules, so you can remove it with
npm uninstall -g generator-[nameOfGenerator]

npm uninstall -g [generator-name] might not fix the UNMET DEPENDENCY.
If you won't mind to reinstall the affected modules:
cd to your npm directory (e.g. /usr/local/bin/node_modules)
rm -rf [generator-name]
npm cache clean
npm install -g [generator-name]

Search for generators with
npm list -g --depth=0 | grep 'generator'
Remove generator with
npm uninstall -g [generator-name]
NOTE: Don't include '#[version] ' that follows the generator name

I wanted to add something for posterity:
If you get an number of errors of class 'peerDependencies' for yeoman's generators, updating yo alone will not cut it - you need to remove all generators that throw the error and then reinstall whatever module lead to the trouble.
Unfortunately, as far as I ahve chekced, regex is not supported by npm.

Related

How to install NPM end-user packages on NixOS?

Is there a way to install NPM command line tools on NixOS?
[root#ip-xxx-xxx-0-27:~/teros/ntrs-cli]# sudo npm i -g typescript
npm WARN checkPermissions Missing write access to /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! path /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! code EROFS
npm ERR! errno -30
npm ERR! syscall access
npm ERR! rofs EROFS: read-only file system, access '/nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
I assume because it's read-only, because I did run:
chown -R `whoami` nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1
as an aside if someone knows how to install Node.js version 11 or 12 on nixos that'd be great.
Firstly, please undo the permissions change (chown) you made. You should NEVER change the permissions of files in the Nix store (/nix/store).
To install NPM packages on NixOS use the corresponding Nix package, instead of using npm -g .... NPM packages are under the nodePackages "namespace".
For example, to install typescript (tsc) edit /etc/nixos/configuration.nix:
...
environment.systemPackages = with pkgs; [
...
nodePackages.typescript;
]
...
Then use nixos-rebuild switch to "install" the package.
You can install Node.js the same way. Use nix search nodejs to see the various versions you can install.
Instead Edit ~/.npmrc so that it tells npm to install and find "global" packages in your home folder instead of the root location:
prefix=~/.npm-packages
now any time you run npm i -g <some-package> you will see that it will be installed inside of ~/.npm-packages.
Now in your shell rc file (f.e. .bashrc or .zshrc or similar), you'll need to update your PATH to include executables from the new location:
### Add NPM executables to your PATH so that they are available as commands:
export PATH="$HOME/.npm-packages/bin:$PATH"
Often it is more convenient to manage ephemeral dependencies outside of the system-level package manager.
If you use something like n or nvm to manage specific node versions, you can do a similar thing by managing them in your home folder.
npm config set prefix '~/mutable_node_modules'
This thread should be helpful:
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-50330167
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-187510024
You can also install them with the usual npm -i..., just without the -g (global) paramater.
looks like things may have changed a bit.
on fish shell with node v16.15.0 and nix (Nix) 2.8.1. I just had to add fish_add_path -g $HOME/.node_modules/bin to my config.fish then npm install -g <package>.

ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0

I get that message every time when trying to install zapier-cli.
Can someone help me with solving the issue?
I think you need to manually install ajv or update it to version 6 if you already have a lower version installed
npm i ajv
I had a similar issue so I installed it manually and everything worked for me
David here, from the Zapier Platform team. It looks like this is a bug with npm itself. Updating npm (npm i -g npm) or manually installing ajv (npm i -g ajv#6) should resolve the warning.
Problems: npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is installed.
You must install peer dependencies by yourself.
You missed the dependencies of ajv#^6.0.0
Just install it :
npm install ajv#^6.0.0

Yeoman : no generator installed error

I'm trying to setup angularfire generator.
I did npm install -g generator angularfire
The generator was installed successfuly.
And when I run yo angularfire in my newly created directory,it asks few options like firebase instance and which modules to include , but after that it shows the following error
You don't seem to have a generator with the name angularfire:common:C:\Users\SATWIK\AppData\Roaming\npm\node_modules\generator-angularfire\app\index.js installed.
Also I've checked that the file index.js does exist at this path.
As suggested in some of the answers on stackoverflow I've also tries npm install -G generator-angularfire and npm install generator-angularfire but none of them worked.
I also did yo doctor but it shows Everything is fine . Is there any fix to this problem?
This is a regression we had in our last release. It's now fixed https://github.com/yeoman/environment/releases/tag/v1.5.2
npm -g update yo to fix that issue.

yo aspnet generator not detected

I am using ubuntu vivid. Trying to use yeoman aspnet generator. Installed the generators using below commands
sudo npm install -g yo
sudo npm install -g generator-aspnet
When i try using it using the command : yo aspnet
i get the below error
Error aspnet
You don't seem to have a generator with the name aspnet installed. You can see available generators with npm search yeoman-generator and then >install them with npm install [name]. To see the 0 registered generators run yo with the `--help` option.
I am able to see the generator files under /usr/local/lib/node_modules/generator-aspnet
What am i missing?
For any Yeoman issues, always run yo doctor.

iOS Yosemite sudo npm install -g DYLD_ environment

I have a problem after I upgraded my machine to Yosemite, whenever I run sudo npm install -g ... I got an error says
/usr/bin/dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
For example was trying to install gulp using
sudo npm install -g gulp
and got the same error ! not able to find the reason behind this issue
Generally this means that an existing, globally installed package is in bad shape. Possibly permissions related, but hard to say for sure without more information about the environment.
The solution lies in fixing the broken package. One way to do so is delete and re-install it. Try sudo npm uninstall -g <pkg> where <pkg> is anything you suspect may be broken.
If you are not sure where to start, do:
npm list -g --depth=0
That will show you all of your globally installed packages. Just remove and re-install them one by one.
If any of those throw errors during the removal process, you will need to do it yourself, manually.
First, figure out where global packages are installed. Generally, this will be /usr/local on OS X, for example. To find out for sure:
npm config get prefix
Then explore that directory, especially /usr/local/bin (for example) and if you are sure a file is related to a global npm package, it's usually safe to remove it.
`sudo rm -rf <file>`
... where <file> is the actual filename you wish to delete.
You may have gotten into this mess due to overuse of sudo.
See my answer to SNAFU with npm update -g on why sudo is bad and instructions on how to fix it.

Resources