tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

Error on deploying dist #116

Closed shyamrock closed 8 years ago

shyamrock commented 8 years ago

After deploying the contents of the dist to the Nginx server, open the site gives the following error:

Uncaught TypeError: (intermediate value)(...) is not a function(anonymous function) @ frontend.min.js:1

vendors.min.js:6 Uncaught Error: [$injector:modulerr] Failed to instantiate module frontend due to: Error: [$injector:nomod] Module 'frontend' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.3.13/$injector/nomod?p0=frontend at http://162.243.231.44/vendors.min.js:6:9417 at http://162.243.231.44/vendors.min.js:6:17749 at e (http://162.243.231.44/vendors.min.js:6:17321) at http://162.243.231.44/vendors.min.js:6:17633 at http://162.243.231.44/vendors.min.js:6:26067 at o (http://162.243.231.44/vendors.min.js:6:9802) at f (http://162.243.231.44/vendors.min.js:6:25915) at zt (http://162.243.231.44/vendors.min.js:6:27605) at J.s (http://162.243.231.44/vendors.min.js:6:15434) at J (http://162.243.231.44/vendors.min.js:6:15744) http://errors.angularjs.org/1.3.13/$injector/modulerr?p0=frontend&p1=Error%…20%20%20at%20J%20(http%3A%2F%2F162.243.231.44%2Fvendors.min.js%3A6%3A15744)(anonymous function) @ vendors.min.js:6(anonymous function) @ vendors.min.js:6o @ vendors.min.js:6f @ vendors.min.js:6zt @ vendors.min.js:6J.s @ vendors.min.js:6J @ vendors.min.js:6Q @ vendors.min.js:6(anonymous function) @ vendors.min.js:10u @ vendors.min.js:2h.fireWith @ vendors.min.js:2J.extend.ready @ vendors.min.js:2a @ vendors.min.js:1

Can somene help me on this, trying to deploy this to server.

tarlepp commented 8 years ago

Hmm, seems like gulp dist is failing some how. Could you run it again and paste the output here. Also after that you could try gulp production which will serve dist version of your application.

Also it would help if you show your dist folder contents after the gulp dist task.

shyamrock commented 8 years ago

Here is what my gulp dist looks like

It is interesting that it is not working now.

function dist(ext, name, opt) { opt = opt || {};

return lazypipe() .pipe(g.concat, name + '.' + ext) .pipe(gulp.dest, './dist') .pipe(opt.ngAnnotate ? g.ngAnnotate : noop) .pipe(opt.ngAnnotate ? g.rename : noop, name + '.annotated.' + ext) .pipe(opt.ngAnnotate ? gulp.dest : noop, './dist') .pipe(ext === 'js' ? g.uglify : g.minifyCss) .pipe(g.rename, name + '.min.' + ext)() //.pipe(gulp.dest, './dist')() ; }

And the output is: ~/Documents/AppDev/Projects/ammo_site/frontend$ gulp dist [09:07:14] Using gulpfile ~/Documents/AppDev/Projects/ammo_site/frontend/gulpfile.js [09:07:14] Starting 'vendors'... [09:07:14] Starting 'assets'... [09:07:14] Starting 'fonts'... [09:07:14] Starting 'clean-css'... [09:07:14] Starting 'templates-dist'... [09:07:14] Finished 'assets' after 101 ms [09:07:14] Finished 'clean-css' after 147 ms [09:07:14] Starting 'styles'... [09:07:15] Finished 'fonts' after 226 ms [09:07:15] Finished 'styles' after 177 ms [09:07:15] Starting 'styles-dist'... [09:07:15] Finished 'styles-dist' after 532 ms [09:07:15] Finished 'templates-dist' after 879 ms [09:07:15] Starting 'scripts-dist'...

stream.js:74 throw er; // Unhandled stream error in pipe. ^ Error: Broken @import declaration of "http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" - timeout

shyamrock commented 8 years ago

However if I change the gulp dist to the following, gulp dist seems to be working

Note //.pipe(gulp.dest, './dist') is commented on the top instead at the bottom. function dist(ext, name, opt) { opt = opt || {};

return lazypipe() .pipe(g.concat, name + '.' + ext) //.pipe(gulp.dest, './dist') .pipe(opt.ngAnnotate ? g.ngAnnotate : noop) .pipe(opt.ngAnnotate ? g.rename : noop, name + '.annotated.' + ext) .pipe(opt.ngAnnotate ? gulp.dest : noop, './dist') .pipe(ext === 'js' ? g.uglify : g.minifyCss) .pipe(g.rename, name + '.min.' + ext) .pipe(gulp.dest, './dist')() ; } Here is the dist folder:

dist: assets fonts frontend.annotated.js frontend.css frontend.min.css frontend.min.js index.html vendors.css vendors.js vendors.min.css vendors.min.js

However still gulp production it gives the same error on localhost:3000

Uncaught TypeError: (intermediate value)(...) is not a function(anonymous function) @ frontend.min.js:1

vendors.min.js:6 Uncaught Error: [$injector:modulerr] Failed to instantiate module frontend due to: Error: [$injector:nomod] Module 'frontend' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second

tarlepp commented 8 years ago

Found couple of errors on gulpfile and bower packages. For some reason bootswatch-dist was causing that font error on gulp dist command.

See the latest commit on frontend https://github.com/tarlepp/angular-sailsjs-boilerplate-frontend/commit/a9e082fc54480a6c22a958c4bc2d84a4876211ed

I tried gulp dist and after that gulp production and there is no errors in console and the application works like it should. I also uploaded dist folder contents to my Apache server and tried that too without any errors.

Closing this now, feel free to re-open if there is still some problems.