Pab*_*blo 8 javascript npm karma-runner
我正在尝试将业力用于不同的手表流程.
我在全球范围内安装了业力:
npm i -g karma
Run Code Online (Sandbox Code Playgroud)
然后跑了karma start karma.conf.js,它工作.
现在我需要karma在项目内部安装
npm install karma
Run Code Online (Sandbox Code Playgroud)
它似乎安装得很好,因为我有文件夹karma node_modules,但是,node_modules/karma/bin/karma似乎不是要运行的可执行文件.
在本地安装后如何运行业力?
小智 6
To run locally on Windows (I'm on Windows 10), I recommend adding the following to your package.json file.
"scripts": {
"test": "cd ./node_modules/karma/bin/ && karma start"
},
Run Code Online (Sandbox Code Playgroud)
Then from the command line, type npm run test
I prefer to not install a cli globally for these kinds of tools and instead run them locally from my project using a script. This way I can quickly see what version is in the dev dependencies and don't have to worry about the global version being different from the local one.
"devDependencies": {
"karma": "^1.4.0"
}
Run Code Online (Sandbox Code Playgroud)
本地安装后运行 Karma:
# Run Karma:
$ ./node_modules/karma/bin/karma start
Run Code Online (Sandbox Code Playgroud)
打字./node_modules/karma/bin/karma start很糟糕,因此您可能会发现全局安装 karma-cli 很有用。如果您想在 Windows 上从命令行运行 Karma,则需要执行此操作。
$ npm install -g karma-cli
Run Code Online (Sandbox Code Playgroud)
然后,您可以从任何地方简单地通过 karma 运行 Karma,并且它将始终运行本地版本。
| 归档时间: |
|
| 查看次数: |
2997 次 |
| 最近记录: |