generator-angular: task “karma” not found when calling `grunt test`

后端 未结 4 1030
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 14:11

I\'m trying to setup a development environment with Yeoman for AngularJS, I installed Yeoman according to the instructions: sudo npm install -g yo bower grunt-cli generato

相关标签:
4条回答
  • 2021-02-01 14:34
    npm install grunt-karma --save-dev
    

    or if you need it

    sudo npm install grunt-karma --save-dev
    

    from the docs on https://npmjs.org/package/grunt-karma

    0 讨论(0)
  • 2021-02-01 14:49

    after running

    npm install grunt-karma --save-dev
    

    add the following line to Gruntfile.js

    grunt.loadNpmTasks('grunt-karma');
    

    this works for me.

    0 讨论(0)
  • 2021-02-01 14:49

    The obvious answers already posted here were completely unhelpful to me. If reinstalling grunt-karma via npm didn't work, and explicitly loading the task in the Gruntfile didn't help, you may be running a version of npm prior to 1.2.10.

    It turns out that recent versions of grunt-karma rely on peer dependencies, which were introduced to Node with version 8.19. After upgrading Nodejs (which also installs npm) and upgrading karma globally, I discovered I needed to edit my karma config files as well. You'll want to add frameworks: ['jasmine'], to karma.conf.js and remove references to JASMINE and JASMINE_ADAPTER from the files setting.

    0 讨论(0)
  • 2021-02-01 14:52

    A was having the problem of Not Found.

    Finally I realize it was a problem with the port (8080 was already used)

    in karma.config.js change the port number:

    // web server port
    port: 9999,
    
    0 讨论(0)
提交回复
热议问题