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.

"File is not defined" error when used wit nuxtjs ssr

See original GitHub issue

Just installed package @2.3.6 (2.3.7 is not sync with npm yet). With a basic use I am getting this error “File is not defined”

import Form from 'form-backend-validation'

data(){
    return {
        form: new Form ({
            email:'',
            password:''
        })
     }
  }

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

4reactions
DJafaricommented, Mar 14, 2019

workaround before fix this issue :

in your nuxt.config.js:

global.File= typeof window === 'undefined' ? Object : window.File
global.FileList= typeof window === 'undefined' ? Object : window.FileList
1reaction
binaryweaverscommented, Mar 14, 2019

@binaryweavers with my approach you don’t need edit dependency file

Anyway, you know what you like

Yeah I appreciate and would prefer your solution. Just mentioned how I did that. Your solution would take care of other packages too, having such issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: File is not defined when using useFieldArray ...
In a Next.js project, in an SSR-ed page, I'm not able to use useFieldArray . ... Steps to reproduce the behavior: Use a...
Read more >
Solve “document is not defined” errors in Next.js | by WebTutPro
Because in the Node.js world, document is not defined, document is only available in browsers. There are three ways to fix that: 1....
Read more >
Next.js: document is not defined - Stack Overflow
I think, in server rendering mode, the document is undefined. You should be able to use it inside class lifecycle methods or useEffect...
Read more >
How to Fix "window is not defined" in Next.js - Upmostly
This issue has to do with Server-Side Rendering in Next.js. Next.js will by default try to use SSR for your site. This means...
Read more >
Advanced Features: Error Handling - Next.js
Error Handling. This documentation explains how you can handle development, server-side, and client-side errors. Handling Errors in Development.
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