alferov / generator-angular-gulp-browserify

A Yeoman generator for creating modern web applications using Angular, gulp, SASS, and Browserify
MIT License
21 stars 7 forks source link

Little issue #5

Open dlmoody opened 9 years ago

dlmoody commented 9 years ago

Thank you for putting this repo together. I have an issue in that when i run gulp unit i get the following error.

 gulp unit
[13:18:31] Requiring external module babel-core/register
[13:18:33] Using gulpfile ~/Projects/angulbrowser/gulpfile.babel.js
[13:18:33] Starting 'views'...
[13:18:33] Finished 'views' after 40 ms
[13:18:33] Starting 'unit'...
[13:18:34] Finished 'unit' after 653 ms
08 11 2015 13:18:36.457:INFO [framework.browserify]: bundle built
08 11 2015 13:18:36.474:INFO [karma]: Karma v0.13.15 server started at http://localhost:9876/__karma__/
08 11 2015 13:18:36.477:INFO [launcher]: Starting browser Chrome
08 11 2015 13:18:37.274:INFO [Chrome 46.0.2490 (Mac OS X 10.10.5)]: Connected on socket 4FoIxdphN8W3ZyyoAAAA with id 72903007
Chrome 46.0.2490 (Mac OS X 10.10.5) ERROR
  Uncaught TypeError: Cannot read property '0' of undefined
  at http://localhost:9876/__karma__/var/folders/48/9q08rhmd0csd0sffpfns0bg40000gn/T/33a70370614ccc44421415fefc7400e5.browserify:65 <- app/js/main.js:9:0
alferov commented 9 years ago

Could you update the generator and try to reproduce this issue? npm install -g generator-angular-gulp-browserify

dlmoody commented 9 years ago

Hey I finally got a chance to try it. it does work. thank you

dlmoody commented 9 years ago

I am sorry I am still getting that error.

Error: No provider for "framework:browserify"! (Resolving: framework:browserify)                                                                                                                                                                                               
    at error (/home/codio/workspace/frontend/node_modules/karma/node_modules/di/lib/injector.js:22:12)                                                                                                                                                                                    
    at Object.parent.get (/home/codio/workspace/frontend/node_modules/karma/node_modules/di/lib/injector.js:9:13)                                                                                                                                                                         
    at [object Object].get (/home/codio/workspace/frontend/node_modules/karma/node_modules/di/lib/injector.js:54:19)                                                                                                                                                                      
    at /home/codio/workspace/frontend/node_modules/karma/lib/server.js:137:20                                                                                                                                                                                                             
    at Array.forEach (native)                                                                                                                                                                                                                                                             
    at [object Object].Server._start (/home/codio/workspace/frontend/node_modules/karma/lib/server.js:136:21)                                                                                                                                                                             
    at [object Object].invoke (/home/codio/workspace/frontend/node_modules/karma/node_modules/di/lib/injector.js:75:15)                                                                                                                                                                   
    at [object Object].Server.start (/home/codio/workspace/frontend/node_modules/karma/lib/server.js:101:18)                                                                                                                                                                              
    at Gulp.<anonymous> (/home/codio/workspace/frontend/gulp/tasks/unit.js:13:6)                                                                                                                                                                                                          
    at module.exports (/home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)                                                                                                                                                                    
    at Gulp.Orchestrator._runTask (/home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/index.js:273:3)                                                                                                                                                             
    at Gulp.Orchestrator._runStep (/home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/index.js:214:10)                                                                                                                                                            
    at /home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/index.js:279:18                                                                                                                                                                                         
    at finish (/home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)                                                                                                                                                                            
    at /home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:52:4                                                                                                                                                                                     
    at f (/home/codio/workspace/frontend/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/node_modules/once/once.js:17:25)   
alferov commented 9 years ago

Hmm, how about:

  1. npm uninstall karma -g npm install karma-cli -g
  2. If the first method doesn't work: Copy and paste the following lines into karma.conf.js:
plugins: [
  require('karma-browserify'),
  require('karma-jasmine'),
  require('karma-chrome-launcher'),
  require('karma-coverage')
],

It seems like karma is not able to resolve dependencies, so let's try to declare it explicitly.

dlmoody commented 9 years ago

awesome i got past that issue. Thank you !!

I am getting this: Can't find variable: Promise but maybe i just need to import that i dont know i have to research it

alferov commented 9 years ago

I am getting this: Can't find variable: Promise

Promise is a native ES2015 data structure, it should be automatically recognized and transpiled by Babel. Are you sure that babelify is enabled in karma-browserify settings?

preprocessors: {
   'app/js/**/*.js': ['browserify', 'coverage']
},
browserify: {
  debug: true,
  extensions: ['.js', '.jsx'],
  transform: [
    'babelify',
    'bulkify',
    istanbul({
      instrumenter: isparta,
      ignore: ['**/node_modules/**', '**/test/**']
    })
  ]
}

Which node.js version are you using? I'd recommend clean the cache: npm clear cache Delete local node_modules folder and reinstall dependencies: npm i

dlmoody commented 9 years ago

it turns out that phantomjs doesnt have support for ES6 Promises. I believe that the fix is to either polyfill phantomjs or use phantomjs2 or some other headless browser that supports Promises. I am useing phantomjs because for this particular thing that I am doing i am setting up on a colud base IDE so there is no browser on the box. No biggy though.

thanks for helping me get it to work and teaching me something about the karma config :-)

On Wed, Nov 11, 2015 at 10:32 AM, Philipp Alferov notifications@github.com wrote:

I am getting this: Can't find variable: Promise

Promise is a native ES2015 data structure, it should be automatically recognized and transpiled by Babel. Are you sure that babelify is enabled in karma-browserify settings?

preprocessors: { 'app/js/*/.js': ['browserify', 'coverage'] }, browserify: { debug: true, extensions: ['.js', '.jsx'], transform: [ 'babelify', 'bulkify', istanbul({ instrumenter: isparta, ignore: ['/node_modules/', '/test/'] }) ] }

Which node.js version are you using? I'd recommend clean the cache: npm clear cache Delete local node_modules folder and reinstall dependencies: npm i

— Reply to this email directly or view it on GitHub https://github.com/alferov/generator-angular-gulp-browserify/issues/5#issuecomment-155817720 .

[image: --]

David Moody [image: https://]about.me/david_moody https://about.me/david_moody?promo=email_sig