我的依赖项中有一个包,位于 npm 的 package.json
中。我已经通过以下方式包含了来自 github 的包-
"dependencies": {
"@aeternity/aepp-components": "git+https://git@github.com/aeternity/aepp-components.git#feature/v3",`
}
当我运行 npm install
时,所有内容都会安装,并且我可以在 node_modules
文件夹中看到该模块。但是,当我尝试 import
和 run
时,npm 给出错误提示
dependancy not found
To install it, you can run: npm install --save aepp-components
我在这里做错了什么?
编辑:我用来导入的片段:
import AeButton from 'aepp-components'
最佳答案
你需要做
import { AeButton } from '@aeternity/aepp-components'
了解如何使用解构导入 AeButton
。 @aeternity
指定文件的默认根源,并帮助您将文件导入映射到它。使用它就会起作用。您也可以在 doc 中查看这里
关于Javascript 不导入从 git 安装的 npm 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51360088/