firebase-functions: Engines node 8 not working
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.<anonymous> (/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 functions
Version info
firebase-tools: 4.0.2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (4 by maintainers)
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:
i don’t like firebase need us to use nodejs v6 and v8.
@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.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.
Node v8.9.0 is what fixed my issue(s)
Looks like I’m stuck at the same spot @leads is
I’ve used
nvm
to use node v8.9.0, have reinstalled bothfirebase-tools
and@google-cloud/functions-emulator
with bothyarn global
andnpm -g
but I still receive the exact same error, along with the warningWarning: 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:
On Serve:
This has been really frustrating…
@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!