无法运行命令〜$ vue在vue cli 3中添加unit-mocha

我想将mocha作为单元测试插件添加到我已创建的vue项目中,该项目是使用CLI 3构建的,即vue create myProj

这是用于vue CLI 3.0.0+的,当前我的项目正在其中运行

当我运行命令时,以下是错误

〜$ vue添加单位摩卡

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/vue-cli-plugin-unit-mocha - Not found
npm ERR! 404
npm ERR! 404  'vue-cli-plugin-unit-mocha@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball,folder,http url,or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Piktorlabs\AppData\Roaming\npm-cache\_logs\2019-11-04T10_03_45_315Z-debug.log
 ERROR  command failed: npm install --loglevel error -D vue-cli-plugin-unit-mocha

因此,根据https://www.npmjs.com/package/@vue/cli-plugin-unit-mocha上的NPM文档

它说要运行命令〜$ vue add unit-mocha 在已经创建的项目中添加摩卡单元测试插件,但是我在CLI中收到404错误,提示npm目录不存在

wangkvin 回答:无法运行命令〜$ vue在vue cli 3中添加unit-mocha

问题是我没有将Vue cli更新到最新版本,cli版本是2.6.0 ...一旦我将其更新到4.0 0,问题就解决了

本文链接:https://www.f2er.com/3167615.html

大家都在问