I have created a website using ReactJS and is running perfect on my local machine.
But when I run npm run build
this is the error I got:
> react-snap
� pageerror at /personal-site/: SyntaxError: Unexpected token '<'
✅ crawled 1 out of 1 (/personal-site/)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! personal-site@2.1.0 postbuild: `react-snap`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the personal-site@2.1.0 postbuild 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! C:\Users\[MYUSERNAMEHERE]\AppData\Roaming\npm-cache\_logs\2020-08-24T04_04_29_334Z-debug.log
I am planning to deploy this to github pages. In my package.json, I have the following line as homepage:
"name": "personal-site",
"version": "2.1.0",
"homepage": "https://[MYUSERNAME].github.io/personal-site/",
Note that personal-site is the name of my project and repository both. I also have a .env
file that looks like the following:
NODE_ENV=production
PORT=7999
BASE_PATH=/personal-site/
What is the reason for this error? Also, How can I overcome this error?
The following is the debug log. [Trimmed]
...
24 verbose node v12.18.1
25 verbose npm v6.14.5
26 error code ELIFECYCLE
27 error errno 1
28 error personal-site@2.1.0 postbuild: `react-snap`
28 error Exit status 1
29 error Failed at the personal-site@2.1.0 postbuild script.
29 error This is probably not a problem with npm. There is likely additional logging output above.
30 verbose exit [ 1, true ]