oe-cloud icon indicating copy to clipboard operation
oe-cloud copied to clipboard

TypeError: require(...) is not a function

Open krajasekhar opened this issue 6 years ago • 7 comments

Getting these errors in the console after running

No Config File in Application. Framework default config will be used. node_modules/oe-cloud/server/config.development.json

var jsFeel = require('js-feel')(); ^

TypeError: require(...) is not a function at Object. (...\oe-cloud-master\common\models\framework\decisi on-graph.js:9:32)

TypeError: require(...) is not a function at Object. (...\oe-cloud-master\common\models\framework\decision-serv ice.js:9:30)

TypeError: require(...) is not a function at Object. (...\oe-cloud-master\common\models\framework\decision-tabl e.js:9:32)

var { createDecisionGraphAST, executeDecisionService } = jsFeel.decisionService; ^ TypeError: Cannot destructure property createDecisionGraphAST of 'undefined' or 'null'. at Object. (..\oe-cloud-master\common\models\framework\decisi on-graph.js:15:65)

Unhandled rejection Error: Callback was already called. at ...\oe-cloud\node_modules\async\dist\async.js:966:32

krajasekhar avatar May 31 '18 11:05 krajasekhar

Hi @krajasekhar

Can you confirm the version of oe-cloud you are using from package.json of your application.

deostroll avatar May 31 '18 11:05 deostroll

Also what is version of node.js?

raghav135 avatar May 31 '18 11:05 raghav135

oecloud version: 1.4.2 node js version: 8.9.3

krajasekhar avatar May 31 '18 13:05 krajasekhar

1.4.2 :question: :confused:

I am assuming you were referring to js-feel version. You may need to open the package.json file in the js-feel folder (inside node_modules). Paste the contents of the file here so we may get a better idea what actually downloaded.

deostroll avatar Jun 01 '18 03:06 deostroll

I thought you are asking for this oecloud repository version. Mentioning correctly now. please check. Root folder of the repository : {"name": "oe-cloud", "version": "1.4.2"} js-feel in node_modules : {"name": "js-feel","version": "1.1.0"} oe-cloud in node_modules : {"name": "oe-cloud","version": "0.9.3"}

I believe the problem is because of installation of some of the modules to its latest version other than what given in package.json. I didn't have git installed in server (manually uploaded the repo) and 'npm install' failed. so I manually installed each module with 'npm install ' and got the above errors.

krajasekhar avatar Jun 01 '18 05:06 krajasekhar

Our latest release of oe-cloud at the moment is v1.4.0. It is important your front-end application that is depending on oe-cloud point to this version. I recommend you to take a backup of your current node_modules. Update your app's package.json to point to this version of oe-cloud. And do an npm install (i.e. a fresh npm install).

According to what you reported, the js-feel version is old, and, you are probably using some recent version of oe-cloud (>1.2.0). Hence the error.

deostroll avatar Jun 04 '18 09:06 deostroll

@krajasekhar my apologies. The package.json shows that we are in 1.4.2, I wasn't aware of this at the time.

As long as your copy of oe-cloud (inside your app) is downloaded off this commit, 97b3ae5, you should not face an issue. But if your copy reflects this commit, 2bfbba5, then this issue would surface again. The latter is what comes with the latest release (v1.4.0), and this is a known issue.

I had the impression that the latter commit had those changes already somehow. But apparently that is not the case. Sorry, it is my mistake.

If you see this issue again you can revert back.

deostroll avatar Jun 27 '18 13:06 deostroll