gsoft-inc/azure-pipelines-lighthouse

npm package "lighthouse" is not installed globally or locally

Closed this issue ยท 7 comments

Started to get this error on a Release pipeline for Azure DevOps

2023-02-10T10:01:46.5101000Z ##[section]Starting: Lighthouse https://*** Mobile
2023-02-10T10:01:46.6598492Z ==============================================================================
2023-02-10T10:01:46.6599254Z Task         : Lighthouse
2023-02-10T10:01:46.6599713Z Description  : Display Google Lighthouse reports and evaluate audit scores with assertions.
2023-02-10T10:01:46.6600172Z Version      : 1.0.6
2023-02-10T10:01:46.6600817Z Author       : GSoft
2023-02-10T10:01:46.6601361Z Help         : You can provide the lighthouse NPM package, otherwise it will be installed in a temporary directory.
2023-02-10T10:01:46.6601691Z ==============================================================================
2023-02-10T10:01:47.7665695Z Node.js found at: C:\Program Files\nodejs\node.exe
2023-02-10T10:01:47.7915425Z NPM found at: C:\Program Files\nodejs\npm.cmd
2023-02-10T10:01:47.7928982Z Temporary directory: D:\a\_temp\__lighthouse
2023-02-10T10:01:47.7941220Z Lighthouse target URL: https://***
2023-02-10T10:01:47.7950742Z Working directory: D:\a\r1\a
2023-02-10T10:01:47.8051931Z Lighthouse HTML report will be saved at: D:\a\_temp\__lighthouse\***-15639.report.html
2023-02-10T10:01:47.8053160Z Lighthouse JSON report will be saved at: D:\a\_temp\__lighthouse\***-15639.report.json
2023-02-10T10:01:47.8540225Z Existing Lighthouse installation not found
2023-02-10T10:01:47.8541313Z Lighthouse will be installed using NPM at: D:\a\_temp\__lighthouse
2023-02-10T10:01:47.8586709Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" install lighthouse --prefix D:\a\_temp\__lighthouse "--loglevel=error""
2023-02-10T10:02:26.4108165Z 
2023-02-10T10:02:26.4118508Z added 128 packages, and audited 129 packages in 35s
2023-02-10T10:02:26.4122962Z 
2023-02-10T10:02:26.4125598Z 17 packages are looking for funding
2023-02-10T10:02:26.4132358Z   run `npm fund` for details
2023-02-10T10:02:26.4134277Z 
2023-02-10T10:02:26.4139549Z found 0 vulnerabilities
2023-02-10T10:02:26.4595560Z 
2023-02-10T10:02:26.4684743Z Installing Lighthouse with NPM returned: 0
2023-02-10T10:02:26.4730471Z ##[error]npm package "lighthouse" is not installed globally or locally
2023-02-10T10:02:26.4759225Z Lighthouse task finished

I just found this error as well. I believe it is because a new version of lighthouse has just been released and it appears that version 10 is not supported by this task yet.

We have a step to install lighthouse manually before running the lighthouse task so I updated that to install version 9 of lighthouse and it works again now.

@nocturnalpie as in just a simple NPM install before it?

@andrew-flatters-bliss I just have a step to run npm install lighthouse@^9

@nocturnalpie Cheers ye that is exactly what I tried off your comment and that seems to have resolved our build for now.

Thank you for reporting the issue. Indeed, Lighthouse index.js path has changed from node_modules/lighthouse/lighthouse-cli/index.js to node_modules/lighthouse/cli/index.js in version 10.0.0. We will provide an updated version hopefully next week or the one after.

Confirmed all working without the additional NPM install step now ๐Ÿ‘