Can't uninstall a package using npm? - node.js

Why is npm uninstall -g not uninstalling a package?
$ which flourish
/Users/me/.nvm/versions/node/v8.3.0/bin/flourish
$ which npm
/Users/me/.nvm/versions/node/v8.3.0/bin/npm
$ npm uninstall -g flourish
up to date in 0.056s
$ flourish
😱 No command specified. Type β€˜flourish help’ for help.
Local uninstall doesn't help either:
$ npm uninstall flourish
up to date in 1.266s
$ flourish
😱 No command specified. Type β€˜flourish help’ for help.
Update - after doing the above:
$ npm -g ls --depth=0
/Users/me/.nvm/versions/node/v8.3.0/lib
...
β”œβ”€β”€ #flourish/sdk#3.6.0
β”œβ”€β”€ #mapbox/geojson-area#0.2.2
β”œβ”€β”€ #mapbox/geojson-merge#1.0.2

Related

NPM can not find globally installed packege

I've installed everything with homebrew on my mac.
$ which node
/opt/homebrew/bin/node
$ which npm
/opt/homebrew/bin/npm
$ npm -g ls
/opt/homebrew/lib
β”œβ”€β”€ #unlighthouse/cli#0.4.9
β”œβ”€β”€ npm#9.4.0
β”œβ”€β”€ prisma#4.9.0
β”œβ”€β”€ puppeteer#19.6.3
└── ts-node#10.9.1
but when I try to run
npx unlighthouse ...
It fails:
Failed to find a chrome / chromium binary to run.
Add the puppeteer dependency to your project to resolve.
Run the following: npm install -g puppeteer
it seems npm can't access/find globally installed package puppeteer
???

Gulp not working - gulp: command not found

warmachine#HH-00 MINGW64 /c/HTML5/app (dev)
$ gulp -v
bash: gulp: command not found
You need to install it globally if you want to use it like that:
npm install -g gulp
Alternatively using Yarn:
yarn add global gulp
In both cases you need to have the NPM/Yarn globals path in PATH.
# Uninstall previous Gulp installation and related packages, if any
$ npm rm gulp -g
$ npm rm gulp-cli -g
$ cd [your-project-dir/]
$ npm rm gulp --save-dev
$ npm rm gulp --save
$ npm rm gulp --save-optional
$ npm cache clean # for npm < v5
# Install the latest Gulp CLI tools globally
$ npm install -g gulp
# Install Gulp 4 into your project as dev dependency
$ npm install gulp --save-dev
# Check the versions installed. Make sure your versions are not lower than shown.
$ gulp -v
---
[10:48:35] CLI version 2.0.1
[10:48:35] Local version 4.0.0

How Can I Resolve An 'npm Warn' When Using 'create-react-app'?

I'm getting the following warning when using 'create-react-app': npm WARN prefer global marked#0.3.6 should be installed with -g
How can I get rid of this warning?
I looked at "Question that may already have your answer" and didn't seem to find a precise answer. However, I'm new and may have overlooked the obvious.
My installs are:
$ npm -v
4.3.0
$ node --version
v7.0.0
$ npm list -g create-react-app
/usr/local/lib
└── create-react-app#1.2.1
$ npm list -g marked#
/usr/local/lib
└── marked#0.3.6
It looks to me that this package is already installed globally.
I ran the following:
$ sudo npm update -g create-react-app
which resulted in the following:
$ npm list -g create-react-app
/usr/local/lib
└── create-react-app#1.3.0
However, I still get:
npm WARN prefer global marked#0.3.6 should be installed with -g
Because that package includes the CLI.
Try to remove and install create-react-app to the newest version 1.3.0
npm install -g create-react-app

npm ls matching a pattern?

I just installed a couple of packages to start working with Redux:
npm install --no-optional --save-dev redux-devtools
npm install --no-optional --save react-redux
Then I wanted to make sure everything is installed, so I checked with npm ls:
$ npm ls react redux
MyProject# /home/me/projects/myproject
β”œβ”€β”€ react#15.3.0
└── redux#3.5.2
Yeah, they are here!
However, I wonder if there is a way to check all the packages starting with re. Both of these commands:
npm ls re*
npm ls re
Returned the same error:
MyProject# /home/me/projects/myproject
└── (empty)
npm ERR! code 1
I thought npm search could make it, but as I understand it looks for available packages, not only the ones that you have installed in your machine.
$ npm search re*
NAME DESCRIPTION AUTHOR
requirements-txt requirements-txt - generate requirements.txt (python… =russiani
So: is there a way with npm ls to provide a pattern to check the packages that are installed and match it?
How about piping to grep?
$ npm ls | grep 'lod.*'
└── lodash#3.5.0

npm unable to install karma-jasmine on my mac

When i install karma-jasmine on mac,it gives me errors:
β”œβ”€β”€ UNMET PEER DEPENDENCY jasmine-core#*
└── karma-jasmine#0.3.8
npm WARN karma-jasmine#0.3.8 requires a peer of jasmine-core#* but none was installed.
But,i have installed jasmine-core just before.
npm install jasmine-core -g
/Users/hbowang/.nvm/versions/node/v5.9.0/lib
└── jasmine-core#2.4.1
Any body can help me resolve this error?
I also got this error, but my package.json file is also missing so by creating package json file i am able to install jasmine-core and karma-jasmine.
For creating package.json file:
$ npm init
then after install jasmine-core:
$ npm install jasmine-core
$ npm install karma --save-dev
$ npm install karma-jasmine --save-dev
Hope it will help!!
you are installing jasmine-core with the global flag.
try installing it without the -g option and then retry.
notice the words UNMET PEER DEPENDENCY which suggests it wants it installed at the same level not globally maybe?

Resources