dialogflow-fulfillment-nodejs icon indicating copy to clipboard operation
dialogflow-fulfillment-nodejs copied to clipboard

Support Node >6

Open kjanoudi opened this issue 5 years ago • 33 comments

This line should be "node": ">=6.0.0", it's causing issues with deploying to engines based on node 8 and up. Not sure why it was changed here: https://github.com/dialogflow/dialogflow-fulfillment-nodejs/commit/b8028247b849d7dea2d2e303a88ef109a0f0aa58#diff-b9cfc7f2cdf78a7f4b91a753d10865a2

https://github.com/dialogflow/dialogflow-fulfillment-nodejs/blob/5994311c2155b2571a6de50250665e18d5d375f8/package.json#L12

kjanoudi avatar Oct 18 '18 15:10 kjanoudi

What kind of issues are you seeing?

mattcarrollcode avatar Oct 18 '18 16:10 mattcarrollcode

When trying to build with yarn on node 8:

@matthewayne error [email protected]: The engine "node" is incompatible with this module. Expected version "6". Got "8.12.0"

kjanoudi avatar Oct 18 '18 16:10 kjanoudi

What is your environment/how are you installing/importing the library?

mattcarrollcode avatar Oct 18 '18 16:10 mattcarrollcode

I have it as a dependency in a GCP hosted cloud function deployed by serverless with webpack. It serves as fulfillment to a dialogflow agent without using actions on Google or the Google assistant.

kjanoudi avatar Oct 18 '18 17:10 kjanoudi

@kjanoudi Cloud Firebase only allows for "node" to either be "6" or "8". Not "8.12.0", I hope that helps

aradwyr avatar Oct 18 '18 20:10 aradwyr

@kjanoudi I take it your cloud function is using node 8?

mattcarrollcode avatar Oct 18 '18 21:10 mattcarrollcode

@matthewayne correct. @sarahdwyer it does not work with 8 either.

kjanoudi avatar Oct 18 '18 21:10 kjanoudi

Is there any particular feature or requirement that is not supported by Node 8 and would expand this change by more than just a package.json modification?

kjanoudi avatar Oct 20 '18 02:10 kjanoudi

I have basically the same error when trying to add it to a custom node server:

error [email protected]: The engine "node" is incompatible with this module. Expected version "6". Got "10.8.0"

Askir avatar Oct 25 '18 07:10 Askir

@kjanoudi Cloud Firebase works fine for me with Node: "8", can you post all of your dependencies?

aradwyr avatar Oct 25 '18 17:10 aradwyr

@sarahdwyer

    "dialogflow": "^0.7.0",
    "dialogflow-fulfillment": "^0.6.1",
    "firebase-admin": "^6.0.0",
    "humanize-duration": "^3.15.3",
    "uuid": "^3.3.2"

It works fine with this change: https://github.com/dialogflow/dialogflow-fulfillment-nodejs/pull/157/files

However, without it, I get error [email protected]: The engine "node" is incompatible with this module. Expected version "6". Got "8.12.0"

kjanoudi avatar Oct 25 '18 17:10 kjanoudi

Any progress on this? @sarahdwyer

kjanoudi avatar Nov 02 '18 03:11 kjanoudi

Same error on my side:

error [email protected]: The engine "node" is incompatible with this module. Expected version "6". Got "8.10.0"

Vadorequest avatar Nov 29 '18 11:11 Vadorequest

Here is the package.json I downloaded (had to move to node6 to fetch it)

{
  "name": "dialogflow-fulfillment",
  "description": "Dialogflow Fulfillment Library for Node.js",
  "main": "src/dialogflow-fulfillment.js",
  "version": "0.6.1",
  "license": "Apache-2.0",
  "author": "Google Inc.",
  "directories": {
    "test": "test"
  },
  "engines": {
    "node": "6"
  },
  "scripts": {
    "test": "npm run lint && ava",
    "lint": "eslint --fix \"src/**/*.js\" \"test/*.js\" \"script/*.js\"",
    "docs": "node ./generateDocs.js",
    "zip": "npm run zip:actions-on-google && npm run zip:multilocale && npm run zip:temperature-converter && npm run zip:quick-start",
    "zip:actions-on-google": "node ./script/generateZip.js --indexjs ./samples/actions-on-google/functions/index.js --packagejson ./samples/actions-on-google/functions/package.json --agentzip ./samples/actions-on-google/actions-on-google-agent.zip",
    "zip:multilocale": "node ./script/generateZip.js --indexjs ./samples/multi-lang-and-locale/functions/index.js --packagejson ./samples/multi-lang-and-locale/functions/package.json --agentzip ./samples/multi-lang-and-locale/multilocale-agent.zip",
    "zip:temperature-converter": "node ./script/generateZip.js --indexjs ./samples/parameters-contexts-and-rich-responses/functions/index.js --packagejson ./samples/parameters-contexts-and-rich-responses/functions/package.json --agentzip ./samples/parameters-contexts-and-rich-responses/temperature-converter-agent.zip",
    "zip:quick-start": "node ./script/generateZip.js --indexjs ./samples/quick-start/functions/index.js --packagejson ./samples/quick-start/functions/package.json --agentzip ./samples/quick-start/quickstart-agent.zip"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/dialogflow/dialogflow-fulfillment-nodejs.git"
  },
  "bugs": {
    "url": "https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues"
  },
  "homepage": "https://github.com/dialogflow/dialogflow-fulfillment-nodejs#readme",
  "keywords": [
    "dialogflow",
    "api.ai",
    "client library",
    "webhook",
    "fulfillment"
  ],
  "dependencies": {
    "debug": "^3.1.0",
    "lodash": "^4.17.11"
  },
  "peerDependencies": {
    "actions-on-google": "^2.4.1"
  },
  "devDependencies": {
    "ava": "^0.24.0",
    "eslint": "^4.15.0",
    "eslint-config-google": "^0.9.1",
    "jsdoc-to-markdown": "^4.0.1",
    "jszip": "^3.1.5",
    "commander": "^2.15.1"
  }
}

I believe the change was made (see below), but the npm package wasn't updated, still using hardcoded node 6 version.

https://github.com/dialogflow/dialogflow-fulfillment-nodejs/blob/master/package.json#L12

Vadorequest avatar Nov 29 '18 11:11 Vadorequest

@matthewayne @kjanoudi I believe releasing a new npm version would just fix this issue :)


Workaround: yarn add dialogflow-fulfillment actions-on-google --ignore-engines

See https://stackoverflow.com/questions/45088031/how-to-ignore-incompatible-engine-node-error-on-installing-npm-dependencies-wi

Vadorequest avatar Nov 29 '18 11:11 Vadorequest

Hi @Vadorequest you're running that workaround on a custom server correct? (i.e not Cloud Functions?)

sarupbanskota avatar Nov 30 '18 04:11 sarupbanskota

@sarupbanskota Yes, I'm running my function on AWS Lambda

The workaround is executed on my personal computer, I use the Serverless Framework to deploy the stack. (if you're not familiar with SLS framework, just consider that I do the build on my computer, then deploy that build on AWS, which is similar with having a custom server)

The workaround can be used both on personal computers (localhost, development env) and on a server (production env)

I do not know how to skip "engines" check on Firebase, but if you deploy on AWS/GCP/Azure, the workaround should be the same.

Vadorequest avatar Nov 30 '18 09:11 Vadorequest

The workaround can be used both on personal computers (localhost, development env) and on a server (production env)

Indeed; I was looking for a way to use the yarn flag on a Firebase deployment.

Haven't used it yet, but I like the idea of deploying a local build via SLS Framework - more predictable. Will give it a try - thanks!

sarupbanskota avatar Nov 30 '18 09:11 sarupbanskota

Can we get a new npm release for this? I see it's fixed in master

kjanoudi avatar Dec 02 '18 00:12 kjanoudi

The best workaround I've found isn't the --ignore-engines but simply changing the path for the package in package.json

"dialogflow-fulfillment": "dialogflow/dialogflow-fulfillment-nodejs",

Avoids additional issues.

Vadorequest avatar Dec 02 '18 00:12 Vadorequest

Thanks for the solution, yet this is causing error in my google cloud build.

Can the package.json modified so we don't need to use --ignore-engines ?

sariroti avatar Jan 30 '19 05:01 sariroti

I suffer from this problem too. Can`t deploy to firebase functions using firebase-cli. Only installing it from master branch directly from repository helps.

ivan-kaminskyi avatar Mar 11 '19 15:03 ivan-kaminskyi

Solved it by installing packages

  • dialogflow-fulfillment/dialogflow-fulfillment-nodejs
  • actions-on-google/actions-on-google-nodejs

Just do yarn add or npm install and any of the above packages.

ajays97 avatar May 21 '19 02:05 ajays97

How is this still a problem, @matthewayne, with 118cfa083c38fdb938c8d0d4452eca6d4df69b35 now in master? Is the npm module being neglected?

I imagine my use-case is similar to others: I develop on a 10.x or 12.x Node.js locally, and copy those versions to my production server.

@ajays97, your fix is almost perfect - at least from a yarn perspective:

I couldn't do an yarn add dialogflow-fulfillment/dialogflow-fulfillment-nodejs, instead I just dropped that link in my package.json and did a yarn install.

vSanjo avatar Jul 23 '19 03:07 vSanjo

i managed to install the 2 packages (dialogflow-fulfillment and actions-on-google) successfully using the following yarn command in terminal...

yarn add https://github.com/dialogflow/dialogflow-fulfillment-nodejs
yarn add actions-on-google

myhendry avatar Aug 26 '19 01:08 myhendry

@myhendry This should have worked too. https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues/156#issuecomment-442795321

Vadorequest avatar Aug 26 '19 05:08 Vadorequest

Thanks Vadorequest. However will inserting the flag --ignore-engines cause problems when deploying to heroku or aws?

myhendry avatar Aug 26 '19 05:08 myhendry

No, it won't. That flag basically means you're ignoring the engine check, nothing more. So, even if it's specified in the package that it's not compatible with node 6, then it will passe the engine check even if installing using node !6. It doesn't change the behaviour of node whatsoever, it's only related to the package installation sanity checks. :)

Vadorequest avatar Aug 26 '19 07:08 Vadorequest

Thanks @Vadorequest for the clarification

myhendry avatar Aug 26 '19 08:08 myhendry

Is there a replacement for the associated NPM Module? It is 2020 and I getting the same error. This repo hasn't been touched in 2+ years.

Some dependencies could not be validated. The node version for dialogflow-fulfillment package is incompatible.

Is there a replacement we should be using from Google or is this just not being maintained anymore and their is no replacement? The Google documentation leads you here, which makes it quite confusing.

alankleindev avatar Oct 29 '20 01:10 alankleindev