skip to Main Content

In my _document.js I was adding a script in body and this is the error that is returningenter image description here

./pages/_document.js
Error:
x Expected '}', got ''
-[50:1]
<body>
  <Main />
  <NextScript />
  <script>(function(d,z,s){s.src='https://'+d+'/401/'+z;try{(document.body||document.documentElement).append Child(s)}catch(e){}})('goomaphy.com',6701248,document.createElement('script'))</script>
  </body>
</Html>

2

Answers


  1. No space in .appendChild()

    ./pages/_document.js
    Error:
    x Expected '}', got ''
    -[50:1]
    <body>
      <Main />
      <NextScript />
      <script>(function(d,z,s){s.src='https://'+d+'/401/'+z;try{(document.body||document.documentElement).appendChild(s)}catch(e){}})('goomaphy.com',6701248,document.createElement('script'))</script>
      </body>
    </Html>
    Login or Signup to reply.
  2. try to use <Script> tag from next then put the script inside a string like this

    <Script>
    {` your script `}
    </Script>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search