question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Bad argument" error when trying to use the plugin.

See original GitHub issue
var err = this._handle.spawn(options);
                         ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at exports.spawn (child_process.js:380:9)
    at Object.exports.execFile (child_process.js:143:15)
    at capturePage (/Users/yifengwu/Desktop/dev/lava-official/node_modules/prerender-spa-plugin/lib/compile-to-html.js:70:26)
    at /Users/yifengwu/Desktop/dev/lava-official/node_modules/prerender-spa-plugin/lib/compile-to-html.js:88:11
    at _invoke (/Users/yifengwu/Desktop/dev/lava-official/node_modules/hapi/lib/server.js:305:20)
    at internals.Server._invoke (/Users/yifengwu/Desktop/dev/lava-official/node_modules/hapi/lib/server.js:375:16)
    at Items.serial (/Users/yifengwu/Desktop/dev/lava-official/node_modules/hapi/lib/server.js:297:14)
    at done (/Users/yifengwu/Desktop/dev/lava-official/node_modules/hapi/node_modules/items/lib/index.js:31:25)
    at Server.finalize (/Users/yifengwu/Desktop/dev/lava-official/node_modules/hapi/lib/connection.js:171:9)
    at Server.g (events.js:291:16)
    at emitNone (events.js:91:20)
    at Server.emit (events.js:185:7)
    at emitListeningNT (net.js:1278:10)
    at _combinedTickCallback (internal/process/next_tick.js:71:11)

I’m using this plugin with vue-cli webpack template. And here is the code I added in webpack.prod.conf.js:

new PrerenderSpaPlugin(
   path.join(__dirname, '../dist'),
   ['/']
)

The first argument is the root of the built files which has the following file structure:

/dist
   |--- index.html
   |--- /static
        |--- /js
        |--- /css
        |--- /img

Also I came across the same error in the example you provide. I tried in Node v6.7.0 & v4.6.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

23reactions
chrisvfritzcommented, Oct 20, 2016

It sounds like phantomjs didn’t get installed correctly for whatever reason. You can try to install it again with:

$ cd node_modules/phantomjs-prebuilt
$ node install.js
0reactions
galinkarocommented, Aug 7, 2018

I’ve had the same error and just npm rebuild command helped me! For some reason, npm reinstalling did not help…

Read more comments on GitHub >

github_iconTop Results From Across the Web

invalid argument error in plugin - Microsoft Dynamics CRM ...
Incorrect type of attribute value System. Int32 -> this error message usually comes from the incorrect data type that set into the attribute....
Read more >
Getting error of invalid argument after plugin activated
Getting the following error after activating the plugin. And is not able to do any settings in the plugin. Warning: Invalid argument supplied...
Read more >
runtime error: /usr/local/openresty/lualib/resty/core/request.lua ...
bug: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:116: bad argument #1 to 'lower' (string expected, got nil) #7276.
Read more >
Do you get a bad argument error on max? : r/neovim - Reddit
Hi guys, I recently updated nvim to version 0.8.0 and this error started popping up. I tried looking for a cause and how...
Read more >
Bad argument provided error - Mocha Pro - Boris FX Forum
When I launch the UI I'm getting a Bad argument provided error and them ... Try using proxies in Nuke, you don't need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found