My functions/package.json:
```
"dependencies": {
"express": "^4.16.3",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"nuxt": "^1.4.2"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1"
},
"engines": {
"node": "8"
}
error when deploy
âš functions[ssrnuxt]: Deployment error.
Function load error: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /user_code/node_modules/nuxt/lib/core/module.js:14
async ready() {
^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
```
firebase-tools: 4.0.2
Is your local version of node where you're running the deploy 6.x by chance?
On Thu, Aug 2, 2018, 6:37 PM Gabriel Gelado notifications@github.com
wrote:
My functions/package.json:
"dependencies": {
"express": "^4.16.3",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"nuxt": "^1.4.2"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1"
},
"engines": {
"node": "8"
}error when deploy
âš functions[ssrnuxt]: Deployment error.
Function load error: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /user_code/node_modules/nuxt/lib/core/module.js:14
async ready() {
^^^^^SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.(/user_code/node_modules/nuxt/lib/core/index.js:2:16) Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functionsVersion info
firebase-functions:
firebase-tools:
firebase-admin:
Test case Steps to reproduce Were you able to successfully deploy your
functions? Expected behavior Actual behavior—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-functions/issues/299, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_oQcMImTMeEXyo5j7IAIAprjjzo5ks5uM6llgaJpZM4VtPcs
.
I'm having a similar issue except I still get the warning:
Warning: You're using Node.js v8.11.1 but Google Cloud Functions only supports v6.11.5.
Also, the final console output reads:
ReferenceError: exports is not defined
firebase-tools: v5.6.0
package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.12.1",
"firebase-functions": "^1.0.3"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
},
"engines": {
"node": "8"
},
"private": true
}
@j-low yours is a different issue, which is due to the Firebase CLI not having the latest GCF emulator version, I just fixed it in https://github.com/firebase/firebase-tools/pull/879. Thanks for reporting!
I am also having issues.
functions/package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
},
"engines": {
"node": "8"
},
"private": true
}
After deploying the function I was deploying still show up as Runtime Node.js 6 in the firebase console under Functions -> Dashboard where all functions are listed.
I was expecting the functions to list as Runtime Node.js 8.
@elitan Do you have the latest CLI? If you do, it should display the Node versions as it is deploying, and you should see "Node 8" being printed.
@laurenzlong Seems like I did not have the latest CLI.
After running npm install -g firebase-tools and deploying it seems like the functions are runing Node.js 8.
Thanks!
nvm install and use (and default) v8.1.0. 8.0.0 is incompatible w firebase-tools.
@gbgelado any updates? Seems like the newest version of the CLI should solve your issue. Closing this out - if you still experience this problem, feel free to open another issue. Thanks!
Node v8.9.0 is what fixed my issue(s)
nvm install v8.9.0
nvm alias default v8.9.0
@rhroyston you can run firebase server with a version different from the one installled on your system with this command:
npx -p [email protected] -- firebase serve
Node v8.9.0 is what fixed my issue(s)
nvm install v8.9.0 nvm alias default v8.9.0
This fixed it for me, thanks!
i don't like firebase need us to use nodejs v6 and v8.
Hi all.
Having a sad time here!
Using node v 8.9.0 locally, as suggested above.
This is my package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~7.0.0",
"firebase-functions": "^2.2.0"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1"
},
"engines": {
"node": "8"
},
"private": true
}
eslintrc.json content now includes the following:
"parserOptions": {
// Required for certain syntax usages
"ecmaVersion": 6,
"sourceType": "module"
}
and this is the content of my function (index.js)
const functions = require('firebase-functions');
import config from './config'
// Create and Deploy Your First Cloud Functions
// https://firebase.google.com/docs/functions/write-firebase-functions
exports.helloWorld2 = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
firebase serve and firebase deploy errors with: SyntaxError: Unexpected token import (caused by the import line)
Very much hope I'm missing something easy here. Would prefer not to faff around with webpack if I don't have too.
and some further info after I run firebase serve
i functions: Preparing to emulate functions.
Warning: You're using Node.js v8.9.0 but Google Cloud Functions only supports v6.11.5.
âš functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
âš functions: Error from emulator. Error occurred while parsing your function triggers.
Looks like I'm stuck at the same spot @leads is
I've used nvm to use node v8.9.0, have reinstalled both firebase-tools and @google-cloud/functions-emulator with both yarn global and npm -g but I still receive the exact same error, along with the warning Warning: You're using Node.js v8.9.0 but Google Cloud Functions only supports v6.11.5..
I looked at @google-cloud/functions-emulator version 1.0.0-beta.5 and this error message has been removed, so why does it still show?
On Deploy:
i deploying functions
✔ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing app directory for uploading...
Error: Error occurred while parsing your function triggers.
/Users/jennmueng/Documents/Tour-Backend/app/index.js:4
import * as functions from 'firebase-functions';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /Users/jennmueng/.nvm/versions/node/v8.9.0/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
On Serve:
i functions: Preparing to emulate functions.
Warning: You're using Node.js v8.9.0 but Google Cloud Functions only supports v6.11.5.
âš functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
âš functions: Error from emulator. Error occurred while parsing your function triggers.
/Users/jennmueng/Documents/Tour-Backend/app/index.js:4
import * as functions from 'firebase-functions';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /Users/jennmueng/.nvm/versions/node/v8.9.0/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
This has been really frustrating...
@jennmueng
I started another issue here https://github.com/firebase/firebase-functions/issues/421 but quickly closed it.
import isn't supported by any version of node!
Remove that line, and/or just make a really basic function and try deploying it. See if it goes to Functions as a Node 8 function.
see my thread for details on eslintrc.json and make sure the engines setting is 8 in package.json.
But to repeat, sadly, import isn't available in Node 8.
Most helpful comment
I'm having a similar issue except I still get the warning:
Warning: You're using Node.js v8.11.1 but Google Cloud Functions only supports v6.11.5.Also, the final console output reads:
ReferenceError: exports is not definedfirebase-tools: v5.6.0
package.json: