svgexport icon indicating copy to clipboard operation
svgexport copied to clipboard

The "file" argument must be of type string. Received type object

Open Anudorannador opened this issue 6 years ago • 5 comments

anudorannador@ArchOffice:~/Desktop|⇒  svgexport "$PWD/test.svg" "$PWD/test.png" 1.5x
internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
    at validateString (internal/validators.js:125:11)
    at normalizeSpawnArguments (child_process.js:394:3)
    at Object.spawn (child_process.js:532:38)
    at render (/usr/lib/node_modules/svgexport/index.js:124:26)
    at Object.cli (/usr/lib/node_modules/svgexport/index.js:24:5)
    at Object.<anonymous> (/usr/lib/node_modules/svgexport/bin/index.js:2:16)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
anudorannador@ArchOffice:~/Desktop|⇒  npm ls phantomjs-prebuilt -g
/usr/lib
├─┬ [email protected]
│ └── [email protected] 
├── [email protected] 
└─┬ [email protected]
  └── [email protected] 
anudorannador@ArchOffice:~/Desktop|⇒  node -v
v11.1.0

I am new to use this, and I tried many SVG file but same error, so is there anyone can help me to figure out the problem ?

Anudorannador avatar Nov 08 '18 08:11 Anudorannador

have you figured it out?

MarksCode avatar Jan 09 '19 21:01 MarksCode

No, no me but some one helped. see more about this issue. but there are some Chinese.

Anudorannador avatar Jan 10 '19 02:01 Anudorannador

Wait sorry, can you help me understand what made it work for you? Can't read Chinese haha

MarksCode avatar Jan 10 '19 10:01 MarksCode

in short, cause of phantomjs is deprecated, replaced by phantomjs-prebuilt, but svgexport has not updated, still using phantomjs.

The reason why the error occurs because I linked the phantomjs-prebuilt as phantomjs and, finally, failed.

So, I unlinked phantomjs-prebuilt and re-install svgexport with command:

sudo npm install -g svgexport --unsafe-perm

the argument --unsafe-perm to force to install svgexport and the deprecated dependency, phantomjs.

I also think that svgexport is deprecated : )

Anudorannador avatar Jan 11 '19 10:01 Anudorannador

Same issue here.

svgexport ltc.svg output.png internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object at validateString (internal/validators.js:125:11) at normalizeSpawnArguments (child_process.js:399:3) at Object.spawn (child_process.js:532:38) at render (/usr/local/lib/node_modules/svgexport/index.js:124:26) at Object.cli (/usr/local/lib/node_modules/svgexport/index.js:24:5) at Object. (/usr/local/lib/node_modules/svgexport/bin/index.js:2:16) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

jaggedsoft avatar Feb 10 '19 18:02 jaggedsoft