karma-runner / karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
MIT License
281 stars 131 forks source link

Phantom installation failed TypeError: Path must be a string. Received undefined #200

Open Lekensteyn opened 7 years ago

Lekensteyn commented 7 years ago

Please bump the phantomjs-prebuilt dependency to at least 2.1.8 to fix a crash when the TMPDIR environment variable is not set. Upstream fix: https://github.com/Medium/phantomjs/commit/5e6598f

Workaround: set TMPDIR=/tmp on Linux to avoid this report:

    PhantomJS not found on PATH
    Phantom installation failed TypeError: Path must be a string. Received undefined
        at assertPath (path.js:7:11)
        at Object.join (path.js:1211:7)
        at findSuitableTempDirectory (/shared/www/console_view/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/install.js:127:30)
        at /shared/www/console_view/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/install.js:476:19
        at nextTickCallback (/shared/www/console_view/node_modules/kew/kew.js:47:28)
        at _combinedTickCallback (internal/process/next_tick.js:73:7)
        at process._tickCallback (internal/process/next_tick.js:104:9) TypeError: Path must be a string. Received undefined
        at assertPath (path.js:7:11)
        at Object.join (path.js:1211:7)
        at findSuitableTempDirectory (/shared/www/console_view/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/install.js:127:30)
        at /shared/www/console_view/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/install.js:476:19
        at nextTickCallback (/shared/www/console_view/node_modules/kew/kew.js:47:28)
        at _combinedTickCallback (internal/process/next_tick.js:73:7)
        at process._tickCallback (internal/process/next_tick.js:104:9)

node v7.10.0, npm 4.6.1, yarn 0.24.6, karma-phantomjs-launcher 1.0.4

mikkelwf commented 7 years ago

Is this issue solved or what..?

I get a similar error when trying to run with the launcher @1.0.4 on gitlab:

Error running command: Path must be a string. Received null
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.extname (path.js:1431:5)
    at phantomJSExePath (/builds/whnue/whnue-client/node_modules/karma-phantomjs-launcher/index.js:18:12)
    at Object.<anonymous> (/builds/whnue/whnue-client/node_modules/karma-phantomjs-launcher/index.js:107:12)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at getKarmaPluginConfig (/builds/whnue/whnue-client/node_modules/nwb/lib/createKarmaConfig.js:140:18)
    at createKarmaConfig (/builds/whnue/whnue-client/node_modules/nwb/lib/createKarmaConfig.js:163:31)
    at karmaServer (/builds/whnue/whnue-client/node_modules/nwb/lib/karmaServer.js:30:53)
    at testReact (/builds/whnue/whnue-client/node_modules/nwb/lib/commands/test-react.js:17:29)
    at cli (/builds/whnue/whnue-client/node_modules/nwb/lib/cli.js:263:5)
    at Object.<anonymous> (/builds/whnue/whnue-client/node_modules/nwb/lib/bin/nwb.js:31:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
adreyfus commented 7 years ago

I had this error in an other project, and adding phantomjs-prebuilt ^2.1.8 to the dependencies resolved the problem. Then, thanks !

SDAdham commented 2 years ago

I am receiving this error in gitlab pipeline only not my local environment, adding phantomjs-prebuilt does not fix the issue. this happens in image: cypress/browsers:node16.5.0-chrome94-ff93 when i run yarn install here is full error details:

➤ YN0000: │ @fortawesome/fontawesome-common-types@npm:0.2.36 STDOUT 
➤ YN0000: │ serial-number@npm:1.3.0 STDERR Could not read serial number: Error: Command failed: dmidecode -t system | grep Serial
➤ YN0000: │ serial-number@npm:1.3.0 STDERR /bin/sh: 1: dmidecode: not found
➤ YN0000: │ serial-number@npm:1.3.0 STDERR 
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at ChildProcess.exithandler (node:child_process:397:12)
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at ChildProcess.emit (node:events:394:28)
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at maybeClose (node:internal/child_process:1067:16)
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at Socket.<anonymous> (node:internal/child_process:453:11)
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at Socket.emit (node:events:394:28)
➤ YN0000: │ serial-number@npm:1.3.0 STDERR     at Pipe.<anonymous> (node:net:672:12) {
➤ YN0000: │ serial-number@npm:1.3.0 STDERR   killed: false,
➤ YN0000: │ serial-number@npm:1.3.0 STDERR   code: 1,
➤ YN0000: │ serial-number@npm:1.3.0 STDERR   signal: null,
➤ YN0000: │ serial-number@npm:1.3.0 STDERR   cmd: 'dmidecode -t system | grep Serial'
➤ YN0000: │ serial-number@npm:1.3.0 STDERR }
➤ YN0000: │ phantomjs@npm:1.9.20 STDOUT Considering PhantomJS found at /tmp/xfs-c512e0ec/phantomjs
➤ YN0000: │ phantomjs@npm:1.9.20 STDOUT Found PhantomJS at /tmp/xfs-c512e0ec/phantomjs ...verifying
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR Error verifying phantomjs, continuing Error: Command failed: /tmp/xfs-c512e0ec/phantomjs --version
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR node:internal/validators:119
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     ^
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR 
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at new NodeError (node:internal/errors:370:5)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at validateString (node:internal/validators:119:11)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at normalizeSpawnArguments (node:child_process:503:3)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at spawn (node:child_process:691:13)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Object.<anonymous> (/builds/WxdB1zk9/0/<proj>/node_modules/phantomjs/bin/phantomjs:22:10)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Module._compile (node:internal/modules/cjs/loader:1095:14)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Module.load (node:internal/modules/cjs/loader:975:32)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Function.Module._load (node:internal/modules/cjs/loader:816:12)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   code: 'ERR_INVALID_ARG_TYPE'
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR }
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR 
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at ChildProcess.exithandler (node:child_process:397:12)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at ChildProcess.emit (node:events:394:28)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at maybeClose (node:internal/child_process:1067:16)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   killed: false,
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   code: 1,
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   signal: null,
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   cmd: '/tmp/xfs-c512e0ec/phantomjs --version'
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR }
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR Phantom installation failed TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at new NodeError (node:internal/errors:370:5)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at validateString (node:internal/validators:119:11)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Object.join (node:path:1172:7)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at findSuitableTempDirectory (/builds/WxdB1zk9/0/<proj>/node_modules/phantomjs/install.js:127:30)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at /builds/WxdB1zk9/0/<proj>/node_modules/phantomjs/install.js:476:19
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at nextTickCallback (/builds/WxdB1zk9/0/<proj>/node_modules/kew/kew.js:47:28)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at processTicksAndRejections (node:internal/process/task_queues:78:11) {
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR   code: 'ERR_INVALID_ARG_TYPE'
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR } TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at new NodeError (node:internal/errors:370:5)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at validateString (node:internal/validators:119:11)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at Object.join (node:path:1172:7)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at findSuitableTempDirectory (/builds/WxdB1zk9/0/<proj>/node_modules/phantomjs/install.js:127:30)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at /builds/WxdB1zk9/0/<proj>/node_modules/phantomjs/install.js:476:19
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at nextTickCallback (/builds/WxdB1zk9/0/<proj>/node_modules/kew/kew.js:47:28)
➤ YN0000: │ phantomjs@npm:1.9.20 STDERR     at processTicksAndRejections (node:internal/process/task_queues:78:11)
➤ YN0009: │ phantomjs@npm:1.9.20 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-161dc214/build.log)
➤ YN0000: │ cypress@npm:8.5.0 STDOUT [STARTED] Task without title.
frntn commented 2 years ago

Same error as @SDAdham here 😒