lost-pixel / lost-pixel

Open source alternative to Percy, Chromatic, Applitools.

Home Page:https://lost-pixel.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't run visual regression tests locally

QuietMonkey opened this issue · comments

Bug description

Whatever I try I can't launch test locally (and didn't try with github actions and CI).
I tried on my main project and on the two storybook examples provided at https://github.com/lost-pixel/lost-pixel-examples
The result is consistently the same, when I send the command npm run lost-pixel I receive a classic npm error Module not found

Here the complete error message

> example-next-js-pages@0.1.0 lost-pixel /Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages
> lost-pixel

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'node:path'
Require stack:
- /Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages/node_modules/lost-pixel/dist/bin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages/node_modules/lost-pixel/dist/bin.js:7:37)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages/node_modules/lost-pixel/dist/bin.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! example-next-js-pages@0.1.0 lost-pixel: `lost-pixel`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the example-next-js-pages@0.1.0 lost-pixel script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/btaillandier/.npm/_logs/2022-10-24T15_09_24_876Z-debug.log

And here the content of /Users/btaillandier/.npm/_logs/2022-10-24T15_09_24_876Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/btaillandier/.nvm/versions/node/v14.17.1/bin/node',
1 verbose cli   '/Users/btaillandier/.nvm/versions/node/v14.17.1/bin/npm',
1 verbose cli   'run',
1 verbose cli   'lost-pixel'
1 verbose cli ]
2 info using npm@6.14.17
3 info using node@v14.17.1
4 verbose run-script [ 'prelost-pixel', 'lost-pixel', 'postlost-pixel' ]
5 info lifecycle example-next-js-pages@0.1.0~prelost-pixel: example-next-js-pages@0.1.0
6 info lifecycle example-next-js-pages@0.1.0~lost-pixel: example-next-js-pages@0.1.0
7 verbose lifecycle example-next-js-pages@0.1.0~lost-pixel: unsafe-perm in lifecycle true
8 verbose lifecycle example-next-js-pages@0.1.0~lost-pixel: PATH: /Users/btaillandier/.nvm/versions/node/v14.17.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages/node_modules/.bin:/Users/btaillandier/.pyenv/shims:/Users/btaillandier/.pyenv/shims:/Users/btaillandier/.nvm/versions/node/v14.17.1/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
9 verbose lifecycle example-next-js-pages@0.1.0~lost-pixel: CWD: /Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages
10 silly lifecycle example-next-js-pages@0.1.0~lost-pixel: Args: [ '-c', 'lost-pixel' ]
11 silly lifecycle example-next-js-pages@0.1.0~lost-pixel: Returned: code: 1  signal: null
12 info lifecycle example-next-js-pages@0.1.0~lost-pixel: Failed to exec lost-pixel script
13 verbose stack Error: example-next-js-pages@0.1.0 lost-pixel: `lost-pixel`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/btaillandier/.nvm/versions/node/v14.17.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:375:28)
13 verbose stack     at ChildProcess.<anonymous> (/Users/btaillandier/.nvm/versions/node/v14.17.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:375:28)
13 verbose stack     at maybeClose (internal/child_process.js:1055:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid example-next-js-pages@0.1.0
15 verbose cwd /Users/btaillandier/Documents/Work/lost-pixel-examples/example-next-js-pages
16 verbose Darwin 21.6.0
17 verbose argv "/Users/btaillandier/.nvm/versions/node/v14.17.1/bin/node" "/Users/btaillandier/.nvm/versions/node/v14.17.1/bin/npm" "run" "lost-pixel"
18 verbose node v14.17.1
19 verbose npm  v6.14.17
20 error code ELIFECYCLE
21 error errno 1
22 error example-next-js-pages@0.1.0 lost-pixel: `lost-pixel`
22 error Exit status 1
23 error Failed at the example-next-js-pages@0.1.0 lost-pixel script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Node version: v14.17.1
npm version: 6.14.17
local machine is macOS Monterey V12.5

How to reproduce

  1. Clone project from git@github.com:lost-pixel/lost-pixel-examples.git
  2. npm i
  3. npm run build-storybook
  4. npm run lost-pixel
  5. Get the error

Expected behavior

Run visual regression tests

Lost Pixel information

No CI at this point only local tests

lost-pixel logs from CI

No CI at this point

It looks like others have the same issue on other packages with this specific version of node, I'll make some tests with another version of node and will update you

Works perfectly fine with node v18.11.0