GithubHelp home page GithubHelp logo

Comments (11)

mountainash avatar mountainash commented on August 10, 2024 1

Also getting the same error as @y2gabs Running latest with npm add -g @unlighthouse/cli puppeteer then unlighthouse-ci --config-file unlighthouse.config.ts on GitHub Actions ubuntu-22.04 default image.

Will revert to the previous version with npm add -g @unlighthouse/[email protected] puppeteer

from unlighthouse.

y2gabs avatar y2gabs commented on August 10, 2024

getting an error since upgrading to 12.2 this morning that I think is related here. My unlighthouse.config file was working great before upgrading:

(node:691801) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
/home/folder/unlighthouse.config.ts:1
export default {
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:76:18)
at wrapSafe (node:internal/modules/cjs/loader:1283:20)
at Module._compile (node:internal/modules/cjs/loader:1328:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at ModuleWrap. (node:internal/modules/esm/translators:203:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async Module.loader (file:///home/folder/.npm/_npx/944abecbf21dfffb/node_modules/importx/dist/chunks/tsx.mjs:22:10)

Node.js v18.20.2

from unlighthouse.

harlan-zw avatar harlan-zw commented on August 10, 2024

Thank you for the reports, I'm trying to replicate but having issues. I'm not exactly sure what's going on, maybe related to an upstream dependency or 0c6a0eb.

Could you try npx unlighthouse-ci --config-file unlighthouse.config.ts? This should be all that's needed within a CI now but I need to test further.

from unlighthouse.

mountainash avatar mountainash commented on August 10, 2024

@harlan-zw it's the same issue using npx directly:

Run npx unlighthouse-ci --config-file unlighthouse.config.ts
npm WARN exec The following package was not found and will be installed: [email protected]
(node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error:  Unexpected token 'export'
  export default {
  ^^^^^^
  
  SyntaxError: Unexpected token 'export'
  at internalCompileFunction (node:internal/vm:76:18)
  at wrapSafe (node:internal/modules/cjs/loader:1283:20)
  at Module._compile (node:internal/modules/cjs/loader:1328:27)
  at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10)
  at Module.load (node:internal/modules/cjs/loader:1203:32)
  at Module._load (node:internal/modules/cjs/loader:1019:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
  at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
  at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Error: Process completed with exit code 1.

from unlighthouse.

y2gabs avatar y2gabs commented on August 10, 2024

Forgot to mention that I'm using npx directly too. I just specify 0.12.1 in my scan and it works for now. This is such a great tool so thank you for all you do!

from unlighthouse.

mountainash avatar mountainash commented on August 10, 2024

@y2gabs how are you doing that? (what command)? As unlighthouse-ci has only existed since v0.12.2 https://www.npmjs.com/package/unlighthouse-ci?activeTab=versions. npx [email protected] will not work. I'm guessing you are doing npx @unlighthouse/[email protected]?

from unlighthouse.

y2gabs avatar y2gabs commented on August 10, 2024

Using it in bash - npx [email protected]

from unlighthouse.

y2gabs avatar y2gabs commented on August 10, 2024

weird hit & miss issues running 0.12.1 this week unfortunately. Scan only seems to run half the time, the other half it seems to hang during the scan. Weird

from unlighthouse.

mwskwong avatar mwskwong commented on August 10, 2024

@harlan-zw it's the same issue using npx directly:

Run npx unlighthouse-ci --config-file unlighthouse.config.ts
npm WARN exec The following package was not found and will be installed: [email protected]
(node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error:  Unexpected token 'export'
  export default {
  ^^^^^^
  
  SyntaxError: Unexpected token 'export'
  at internalCompileFunction (node:internal/vm:76:18)
  at wrapSafe (node:internal/modules/cjs/loader:1283:20)
  at Module._compile (node:internal/modules/cjs/loader:1328:27)
  at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10)
  at Module.load (node:internal/modules/cjs/loader:1203:32)
  at Module._load (node:internal/modules/cjs/loader:1019:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
  at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
  at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Error: Process completed with exit code 1.

I'm able to reproduce the Unexpected token 'export' issue as well with v0.13.1 (the latest as of this comment is made), but not with npx unlighthouse-ci. It seems starting to appear from v0.12.2.

Failed GitHub Action FYR: https://github.com/mwskwong/mwskwong.com/actions/runs/9573986998/job/26396439815

Workflow

name: Unlighthouse
on: deployment_status

jobs:
  unlighthouse:
    if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g @unlighthouse/cli puppeteer
      - run: npm list -g @unlighthouse/cli
      - run: unlighthouse-ci --site ${{ github.event.deployment_status.environment_url }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          path: ./.unlighthouse

unlighthouse.config.ts

export default {
  cache: false,
  ci: {
    buildStatic: true,
    budget: {
      performance: 95,
      accessibility: 92,
      'best-practices': 100,
      seo: 66,
    },
  },
  scanner: {
    samples: 5,
  },
};

from unlighthouse.

ivanmihaljevicdiageo avatar ivanmihaljevicdiageo commented on August 10, 2024

@harlan-zw Running npx unlighthouse-ci --config-file unlighthouse.config.ts only works if an older version(0.12.1 or lower) is already installed.

In my case, I'm running VM scale sets in ADO. If a job is in the queue for 5 minutes, new VM is provisioned. In this scenario npx unlighthouse-ci --config-file unlighthouse.config.ts fails with the error that others have mentioned because Unlighthouse can't be installed.

However, if I run npm install -g @unlighthouse/[email protected] puppeteer in the first run after provisioning the agent, npx unlighthouse-ci --config-file unlighthouse.config.ts works in subsequent runs.

from unlighthouse.

ivanmihaljevicdiageo avatar ivanmihaljevicdiageo commented on August 10, 2024

After thorough testing, I'm positive this is a dependency issue. After moving from Node v18 to Node v20, specifically v20.15.1, this issue no longer appears. I can run npx unlighthouse-ci in all my pipelines without encountering any issues.

from unlighthouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.