0

I have a donejs application and its running ok in development mode donejs develop, but when I run it in production mode:

  1. donejs build
  2. donejs deploy (to firebase)
  3. NODE_ENV=production donejs start

it will not start and show an error (see CODE A)

This file: file:my-app/dist/bundles/my-app/index.js:704 corresponds to JQuery 3.x and its not a dependency of the project itself but a dependency of can-connect-feathers (https://github.com/canjs/can-connect-feathers). In fact in index.js there is also included JQuery 2.x what makes me think there might be some sort of incompatibility among them.

I already tried changing the project's dependency to JQuery 3.x but didn't help. Actually it will make even donejs develop fail (see CODE B).

I also tried the following: cd my-app/node_modules/steal npm install but didn't help, another error appears and finally tried cd my-app/node_modules/can && npm install but that end up in multiple errors.

I'm using:

  • donejs@0.9.2
  • node@4.6.2
  • npm@2.15.11
  • can-connect-feathers@1.2.1

CODE A

NODE_ENV=production donejs start

my-app@0.0.0 start my-app done-serve --proxy http://localhost:3030 --port 8080 done-serve starting on http://localhost:8080 Potentially unhandled rejection [5] TypeError: Error loading "package.json!npm" at file:my-app/package.json Error loading "bundles/my-app/index" at file:my-app/dist/bundles/my-app/index.js Error evaluating file:my-app/dist/bundles/my-app/index.js Cannot read property 'createElement' of undefined at i (file:my-app/dist/bundles/my-app/index.js:704:20) at file:my-app/dist/bundles/my-app/index.js:1039:2881 at file:my-app/dist/bundles/my-app/index.js:1039:3580 at file:my-app/dist/bundles/my-app/index.js:268:21 at file:my-app/dist/bundles/my-app/index.js:268:27 at Object.exports.runInThisContext (vm.js:54:17) at doEval (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:2059:10) at __eval (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:1976:7) at Loader.exec [as __exec] (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:339:5) at Loader.loader.instantiate (my-app/node_modules/steal/node_modules/steal-systemjs/dist/system.src.js:1517:16)

CODE B

donejs develop

my-app@0.0.0 develop my-app done-serve --develop --proxy http://localhost:3030 --port 8080 done-serve starting on http://localhost:8080 Potentially unhandled rejection [8] Error: Error loading "my-app@0.0.0#index.stache!done-autorender@0.8.0#autorender" at <unknown> Error loading "can@2.3.27#util/jquery/jquery" at file:my-app/node_modules/can/util/jquery/jquery.js Error loading "can@2.3.27#util/jquery/jquery" from "done-autorender@0.8.0#autorender" at file:my-app/node_modules/done-autorender/src/autorender.js Did not find ./node_modules/can/node_modules/jquery/package.json at FetchTask.utils.extend.next (file:my-app/node_modules/steal/ext/npm-crawl.js:532:11) at file:my-app/node_modules/steal/ext/npm-crawl.js:556:33 at tryCatchReject (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1183:30) at runContinuation1 (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1142:4) at Fulfilled.when (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:930:4) at Pending.run (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:821:13) at Scheduler._drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:97:19) at Scheduler.drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:62:9) at nextTickCallbackWith0Args (node.js:436:9) at process._tickCallback (node.js:365:13) Potentially unhandled rejection [16] Error: Error loading "can@2.3.27#util/jquery/jquery" at file:my-app/node_modules/can/util/jquery/jquery.js Error loading "can@2.3.27#util/jquery/jquery" from "my-app@0.0.0#index.stache!done-autorender@0.8.0#autorender" at file:my-app/src/index.stache Did not find ./node_modules/can/node_modules/jquery/package.json at FetchTask.utils.extend.next (file:my-app/node_modules/steal/ext/npm-crawl.js:532:11) at file:my-app/node_modules/steal/ext/npm-crawl.js:556:33 at tryCatchReject (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1183:30) at runContinuation1 (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1142:4) at Fulfilled.when (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:930:4) at Pending.run (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:821:13) at Scheduler._drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:97:19) at Scheduler.drain (my-app/node_modules/steal/node_modules/steal-systemjs/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:62:9) at nextTickCallbackWith0Args (node.js:436:9) at process._tickCallback (node.js:365:13)

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
nico
  • 144
  • 12
  • I"m not sure why it's failing, but your point of there being two jQuery versions brings up a good point about how I built can-connect-feathers. I should pull out jQuery and make it something that you pass in. It won't be a problem at all once the 2.0 prerelease is finished, because it uses the actual feathers-client. Can you go into your node_modules/can-connect-feathers folder and npm install a 2.x version of jQuery and try again? I'll make an issue to remove jQuery from the repo in GitHub. – Marshall Thompson Dec 06 '16 at 04:44
  • I just published a version that allows you to pass a specific version of jQuery: `npm install can-connect-feathers@2.0.0 --save`. Please see if that fixes it for you. The prerelease is now 3.0.0-pre.x – Marshall Thompson Dec 06 '16 at 05:09

1 Answers1

2

If the double jQuery installation is the issue, it should be resolved by version 2.0.0, which is exactly the same as the 1.0 version, but requires that you pass in a jQuery package as the jquery option. So, in addition to whatever else you had in your can-connect-feathers config, you'll need to provide the jquery option:

import $ from 'jquery'
import Feathers from 'can-connect-feathers';

new Feathers({
  jquery: $
});
Marshall Thompson
  • 945
  • 2
  • 8
  • 17