Aaron Cunnington
Aaron Cunnington

Reputation: 1671

react-snap no such file or directory

I have an app that works in the following way:

After I run yarn run build and the postbuild script is executed, it fails immediately with the following error:

yarn run v1.9.4
$ react-snap
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/Users/aington/git/static-help/build/index.html'
error Command failed with exit code 1.

This makes sense, since there are no files in that location.

I know that react-snap prides itself on being a zero-configuration library, but I really would like to configure it so that it can point to the right directory for serving files. Additionally, the Express server provides an authentication library, so that needs to run too.

Is it realistic to expect that react-snap can do this and still crawl and pre-render the site? Or should I explore other options?

Upvotes: 5

Views: 2627

Answers (1)

sgwanlee
sgwanlee

Reputation: 61

Check the default options in index.js

https://github.com/stereobooster/react-snap/blob/97542b802917362773a2601f52d368c01bd5e0f7/index.js#L15

and use it in package.json like the below

"reactSnap" : {
   "source" : "./dist"

}

Upvotes: 6

Related Questions