`Unexpected token export` when running storage upload
Closed this issue · 1 comments
dshukertjr commented
I got the following error message when trying to run the upload.js file, but am I missing something obvious?
firebase-to-supabase % node storage/upload.js som sfda fdsa
/Users/tylershukert/firebase-to-supabase/storage/supabase-keys.js:15
export const keys = {
^^^^^^
SyntaxError: Unexpected token export
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
borjalo commented
Go to the upload.js
file, remove the export
word and write this at the end of the file:
module.exports = { keys }
This is because Node.js is using CommonJS modules by default and it doesn't support the export
syntax.