通过npm安装了一个软件包,得到“找不到此依赖项:”错误

I installed a package called htmldiff by npm install command in my vue project. Then I tried to import the package in one component

import { diff } from 'htmldiff'; // the package didn't use default export

我得到这个错误。

This dependency was not found:

* htmldiff in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Editor3.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save htmldiff

我可以在项目的package.json文件中看到htmldiff。 我还可以看到在htmldiff的package.json中指定了主文件,如下所示:

"main": "htmldiff.js",

我还要看什么?

评论