I'm running macOS Mojave, and I've tried installing the Google Lighthouse package for Node.JS using the NPM package manager using the following npm install
command with the -g
option to install the package globally:
npm install lighthouse -g
But no matter what I do I get the -bash: lighthouse: command not found
error indicating that the command is not recognized by macOS, or perhaps it didn't export correctly. I even tried source ~/.bash_profile
, but it didn't help.
I even tried to uninstall Lighthouse with npm remove lighthouse -g
and ran the following to remove the cache for NPM:
sudo npm cache clean -f
sudo npm install -g n
I then reinstalled with npm install lighthouse -g
and it still says that the command isn't found. I even tried closing all my terminal windows, but the command is still not found.
When I execute the node --version
command it returns: v12.16.1
, and npm -v
returns 6.13.4
. Is the lighthouse
command not compatible with v12 of Node.js?
I'm at my wits end. Does anyone have any idea what's going on? Do I need to export the path for the package or something? Did I miss something else?
I ended up just running v12 of Node.js in Docker container and installed Lighthouse in there and got it to work.
I used "lighthouse": "^5.6.0"
in my package.json
file's dependencies, and then did npm install
before starting the container.
Once the container was running I did a docker ps
to get the container ID, and then I did the docker exec -it CONTAINER_ID /bin/bash
command to enter the container, and the lighthouse
command finally worked in there.