karma start Cannot find module 'jasmine-core'

后端 未结 6 1323
深忆病人
深忆病人 2021-02-06 21:11

I was getting the following error when I ran \"karma start\"

module.js:340 throw err; ^ Error: Cannot find module \'jasmine-core\' at

相关标签:
6条回答
  • 2021-02-06 21:40

    I have this problem, and have tried every suggestion on the page without it fixing the problem. Well, I haven't yet rebooted, so I'll try that next, but I have closed my shell (git-bash) and re-opened it in case it was an environment variable problem. Something is wrong here and I don't think the problem has been identified yet.

    0 讨论(0)
  • 2021-02-06 21:44

    Even with karma and karma-jasmine installed in the local project's node_modules you must still npm install jasmine.

    So for a fresh Karma project:

    1. npm install karma karma-jasmine jasmine to install the required modules locally.

    Optionally add --save-dev to write to your package.json. Note these do not need to be -g globally installed here.

    1. karma start

    This step requires you to have Karma installed globally (sudo npm install -g karma).

    0 讨论(0)
  • 2021-02-06 21:46

    Also, it is important to know the installation path where do you have karma.conf.js file.

    0 讨论(0)
  • 2021-02-06 21:58

    Navigate to folder:

    cd node_modules\karma-jasmine

    Run:

    npm install

    This should download the required dependencies and fix the issue.

    0 讨论(0)
  • 2021-02-06 22:05

    try install jasmine-core globally (Jasmine on NPM). use npm install -g jasmine-core

    0 讨论(0)
  • 2021-02-06 22:06

    I solved using npm install jasmine-core --save-dev

    0 讨论(0)
提交回复
热议问题