Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running as production #5

Open
csbenjamin opened this issue May 24, 2015 · 17 comments
Open

Error when running as production #5

csbenjamin opened this issue May 24, 2015 · 17 comments

Comments

@csbenjamin
Copy link

When I try to execute export SITUATION=production && gulp run I don't get any error whiling building
screenshot from 2015-05-24 11 34 37

but when I try to open in the browser, I get errors
screenshot from 2015-05-24 11 37 43

I don't understand what is happening. When I click in "angular.js" link in the image above, I get this
screenshot from 2015-05-24 11 41 52

I mean, the angular file is pointing to a weird url "http://localhost:9000/file:/home/cristiano/www/loopback/vcsoft/client/jspm_packages/github/angular/[email protected]/angular.js" (the base path of the app in file system is /home/cristiano/www/loopback/vcsoft/client) and when I look at the network tab of the dev tools I can't see a call to this file
screenshot from 2015-05-24 11 45 12

when I open the page in firefox, I get a different error
screenshot from 2015-05-24 11 47 05

Can anyone to understand what is happening here?

@csbenjamin
Copy link
Author

If I remove the routeBundler from run task, The error disappears. I will continue to debug to try to find the error reason.

@lookfirst
Copy link
Owner

Yup, I know the error. Sorry, I've been super busy with a new job and haven't had time to fix it. I'll see if I can get to it this week.

@csbenjamin
Copy link
Author

since you already know the error, I will stop trying to find its reason. I look forward for your fix. Thank you.

@lookfirst
Copy link
Owner

Try turning off the sourceMaps

@csbenjamin
Copy link
Author

well, I put routeBundleConfig.sourceMaps = false but the error is still there

@csbenjamin
Copy link
Author

ah, but with the sourceMaps off, the error changed a little bit
screenshot from 2015-05-24 14 21 37

Now I see that the sourceMaps is the reason why I see the angular.js instead app.js in console

@rqc
Copy link

rqc commented Aug 7, 2015

Hello,

I have a similar issue in production. I am using this generator for the first time and it works out of the box in development mode with gulp run. However, when I try to run in production I get the following error:

➜  myapp  gulp run
[16:15:49] Running as: production
[16:16:00] Using gulpfile /workspace/myapp/gulpfile.js
[16:16:00] Starting 'run'...
[16:16:00] Starting 'recompile'...
[16:16:00] Starting 'clean-e2e'...
[16:16:00] Finished 'clean-e2e' after 16 ms
[16:16:00] Starting 'clean'...
[16:16:01] Finished 'clean' after 64 ms
[16:16:01] Starting 'compile'...
[16:16:01] Starting 'less'...
[16:16:01] Starting 'less-themes'...
[16:16:01] Starting 'html'...
[16:16:01] Starting 'babel'...
[16:16:01] Starting 'babel-coffee'...
[16:16:01] Starting 'json'...
[16:16:01] Starting 'assets'...
[16:16:01] Finished 'less-themes' after 47 ms
[16:16:01] Finished 'assets' after 35 ms
[16:16:01] Finished 'less' after 80 ms
[16:16:01] Finished 'babel-coffee' after 48 ms
[16:16:01] Finished 'json' after 277 ms
[16:16:01] Finished 'html' after 563 ms
[16:16:01] Finished 'babel' after 560 ms
[16:16:01] Finished 'compile' after 587 ms
[16:16:01] Finished 'recompile' after 669 ms
[16:16:01] Starting 'routeBundler'...
tracing source files...
[16:16:01] 'routeBundler' errored after 1.54 ms
[16:16:01] TypeError: path must be a string
  at TypeError (native)
  at Object.fs.open (fs.js:491:11)
  at fs.readFile (fs.js:262:6)
  at lib$rsvp$node$$tryApply (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1376:11)
  at lib$rsvp$node$$handleValueInput (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1476:20)
  at fn (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1464:18)
  at Builder.loadConfig (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/lib/builder.js:110:26)
  at Object.build (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/lib/builder.js:26:18)
  at Gulp.<anonymous> (/workspace/myapp/node_modules/gulp-helpers/dist/tasks/routeBundler.js:38:46)
  at module.exports (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
  at Gulp.Orchestrator._runTask (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
  at Gulp.Orchestrator._runStep (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
  at Gulp.Orchestrator.start (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:79:16)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at cb (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
  at finish (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:53:5)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:81:5)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at cb (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
  at finish (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:53:5)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:81:5)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:52:4
  at f (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/node_modules/once/once.js:17:25)
  at DestroyableTransform.onend (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/index.js:31:18)
  at DestroyableTransform.emit (events.js:129:20)
  at /workspace/myapp/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16
  at process._tickCallback (node.js:355:11)

[16:16:01] 'run' errored after 676 ms
[16:16:01] TypeError: path must be a string
  at TypeError (native)
  at Object.fs.open (fs.js:491:11)
  at fs.readFile (fs.js:262:6)
  at lib$rsvp$node$$tryApply (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1376:11)
  at lib$rsvp$node$$handleValueInput (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1476:20)
  at fn (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1464:18)
  at Builder.loadConfig (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/lib/builder.js:110:26)
  at Object.build (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/lib/builder.js:26:18)
  at Gulp.<anonymous> (/workspace/myapp/node_modules/gulp-helpers/dist/tasks/routeBundler.js:38:46)
  at module.exports (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
  at Gulp.Orchestrator._runTask (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
  at Gulp.Orchestrator._runStep (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
  at Gulp.Orchestrator.start (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:79:16)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at cb (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
  at finish (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:53:5)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:81:5)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at cb (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
  at finish (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:53:5)
  at runNextSet (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:81:5)
  at Gulp.onTaskEnd (/workspace/myapp/node_modules/gulp-helpers/node_modules/run-sequence/index.js:68:5)
  at Gulp.emit (events.js:129:20)
  at Gulp.Orchestrator._emitTaskDone (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at /workspace/myapp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:52:4
  at f (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/node_modules/once/once.js:17:25)
  at DestroyableTransform.onend (/workspace/myapp/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/index.js:31:18)
  at DestroyableTransform.emit (events.js:129:20)
  at /workspace/myapp/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16
  at process._tickCallback (node.js:355:11)

I looked int the gulpfile.js configuration for routeBundler and it comes with the following configuration;

var routeBundleConfig = {
    baseURL: path.output,
    main: 'app/app',
    routes: routesSrc,
    bundleThreshold: 0.6,
    config: path.systemConfig,
    sourceMaps: true,
    minify: false,
    dest: 'dist/app',
    destJs: 'dist/app/app.js'
};

A closer look at the current configuration fields for routeBundler found here point out that there are some outdated configuration keys that the gruntfile.js has. I changed destJS for destMain and config for systemConfig. This is how the new gulp task looks like:

var routeBundleConfig = {
    baseURL: path.output,
    main: 'app/app',
    routes: routesSrc,
    bundleThreshold: 0.6,
    systemConfig: path.systemConfig,
    sourceMaps: true,
    minify: false,
    dest: 'dist/app',
    destMain: 'dist/app/app.js'
};

After changing those keys and running gulp run again, I get the following:

 TypeError: baseURL should only be configured once and must be configured first.
  at SystemJSNodeLoader.SystemJSLoader.config (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/node_modules/systemjs/dist/system.src.js:1464:13)
  at Builder.config (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/lib/builder.js:127:10)
  at /workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/lib/builder.js:29:15
  at lib$rsvp$$internal$$tryCatch (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:493:16)
  at lib$rsvp$$internal$$invokeCallback (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:505:17)
  at lib$rsvp$$internal$$publish (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:476:11)
  at lib$rsvp$asap$$flush (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1198:9)
  at process._tickCallback (node.js:355:11)

[16:25:51] 'run' errored after 643 ms
[16:25:51] TypeError: baseURL should only be configured once and must be configured first.
  at SystemJSNodeLoader.SystemJSLoader.config (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/node_modules/systemjs/dist/system.src.js:1464:13)
  at Builder.config (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/systemjs-builder/lib/builder.js:127:10)
  at /workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/lib/builder.js:29:15
  at lib$rsvp$$internal$$tryCatch (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:493:16)
  at lib$rsvp$$internal$$invokeCallback (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:505:17)
  at lib$rsvp$$internal$$publish (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:476:11)
  at lib$rsvp$asap$$flush (/workspace/myapp/node_modules/gulp-helpers/node_modules/systemjs-route-bundler/node_modules/rsvp/dist/rsvp.js:1198:9)
  at process._tickCallback (node.js:355:11)

Now I am a bit stuck at this point. Not sure where the baseUrl is supposed to be defined in this project structure. A quick regex search on the project structure in sublime yields the following:

/workspace/myapp/gulpfile.js:
   78  
   79  var routeBundleConfig = {
   80:  baseURL: path.output,
   81   main: 'app/app',
   82   routes: routesSrc,

/workspace/myapp/package.json:
    9    "jspm": {
   10      "directories": {
   11:       "baseURL": "dist",
   12        "lib": "src",
   13        "packages": "jspm_packages"

/workspace/myapp/protractor.conf.js:
   11   // A base URL for your application under test. Calls to protractor.get()
   12   // with relative paths will be prepended with this.
   13:  baseUrl: 'http://localhost:9000',
   14  
   15   // Capabilities to be passed to the webdriver instance.

/workspace/myapp/system.config.js:
    1  System.config({
    2:   "baseURL": ".",
    3    "transpiler": "babel",
    4    "babelOptions": {

Any suggestions?

Thanks in advance!

@lookfirst
Copy link
Owner

Yup. I've recently started a new company and we are about to launch... this means that I haven't had time to keep this project up on the development advances of jspm and systemjs-route-bundler... a lot has changed... ugh! Basically, the path forward is to just bring everything up to speed... PR's welcome as my time is super limited right now.

@rqc
Copy link

rqc commented Aug 10, 2015

@lookfirst Thanks for your reply. As a workaround I turned off the routeBundler task in production. I will let you know if I come up with a real fix for this. Thanks for the project!

@lookfirst
Copy link
Owner

Yea. That's what I did too. Stopped using it. Too much trouble. I just bundle with jspm api directly. Just a couple lines of code.

On Aug 10, 2015, at 5:31 AM, Ricardo Quintana [email protected] wrote:

@lookfirst Thanks for your reply. As a workaround I turned off the routeBundler task in production. I will let you know if I come up with a real fix for this. Thanks for the project!


Reply to this email directly or view it on GitHub.

@lookfirst
Copy link
Owner

import {Builder} from 'jspm';

let bundler = (app) => {
    let builder = new Builder();
    return builder.buildSFX(`js/${app}/app`, `${path.war}/js/${app}/${app}-bundle.js`,
        {minify: situation.isProduction() || situation.isDemo(), sourceMaps: false});
};

I found that my current app didn't need the optimization of route base bundling.

@Fen1kz
Copy link

Fen1kz commented Aug 16, 2015

@lookfirst could you please describe where to put this snippet?

@lookfirst
Copy link
Owner

@Fen1kz I'm using it in my gulp build.

@DominicBoettger
Copy link

Same error here....

@DominicBoettger
Copy link

Copied old version of systemjs-route-bundler (1.1.1) which shipped rsvp 3.0.18 and everything is working again. Any ideas how this can be solved forever?

@rqc
Copy link

rqc commented Aug 31, 2015

@DominicBoettger No, I haven't investigated this any further.

@DominicBoettger
Copy link

Hi,

i removed route-bundler and migrated gulp to es6 (+gulp version upgrade + systemjs update). Everything seems to work except creating the depcache fails.

warn jspm_packages must be specified in the package.json within the baseURL for paths to resolve correctly.
     Injecting the traced dependency tree for app/app...

err  Error: ENOENT, open '/Users/dominic.boettger/Development/jspm_packages/github/angular/[email protected]'
         at Error (native)

The corect path for jspm_packages is /Users/dominic.boettger/Development/myproject/jspm_packages.

package.json jspm config

  "jspm": {
    "directories": {
      "baseURL": "dist",
      "lib": "src",
      "packages": "jspm_packages"
    },
    "configFile": "system.config.js",

System.config.js path config

  baseURL: ".",
  defaultJSExtensions: true,
  transpiler: "babel",
  babelOptions: {
    "optional": [
      "runtime"
    ]
  },
  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },

Any ideas why this fails? I tried different path combinations, but it always fails.

Hope somebody is able to help me.

Thanks a lot!

Best regards
Dominic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants