Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自己发了一个npm包,安装成功且引用后,并没有拷贝到dist/npm中,一直提示找不到 #3127

Closed
MuJinYan opened this issue May 22, 2019 · 5 comments
Assignees

Comments

@MuJinYan
Copy link

MuJinYan commented May 22, 2019

问题描述 自己使用原生小程序方法封装了一个npm包,安装成功后,在app.js也进行了引用,但并未自动拷贝到dist/npm中,编译时一直提示找不到npm包

复现步骤
在node_modules中已看到成功安装,且将此npm包直接在原生微信小程序可成功引用
但在app.js中进行引用
import { Location } from 'fantuan-platform-miniprogram'
编译时并未自动放入dist/npm包,造成一直提示缺少npm包

报错信息
缺少npm包fantuan-platform-miniprogram,开始安装...
warning " > @tarojs/[email protected]" has unmet peer dependency "classnames@^2.2.5".
warning " > @tarojs/[email protected]" has unmet peer dependency "omit.js@^1.0.0".
warning " > @tarojs/[email protected]" has unmet peer dependency "weui@^1.1.2".
warning " > [email protected]" has incorrect peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "dva@^2.0.4".
缺少npm包fantuan-platform-miniprogram,开始安装...

系统信息
➜ myApp git:(master) ✗ taro info
👽 Taro v1.2.4

Taro CLI 1.2.4 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
npmPackages:
@tarojs/async-await: 1.2.4 => 1.2.4
@tarojs/components: 1.2.4 => 1.2.4
@tarojs/plugin-babel: ^1.3.0-beta.3 => 1.3.0-beta.3
@tarojs/plugin-csso: 1.2.4 => 1.2.4
@tarojs/plugin-sass: 1.2.4 => 1.2.4
@tarojs/plugin-uglifyjs: ^1.3.0-beta.3 => 1.3.0-beta.3
@tarojs/redux: 1.2.4 => 1.2.4
@tarojs/redux-h5: 1.2.4 => 1.2.4
@tarojs/router: 1.2.4 => 1.2.4
@tarojs/taro: 1.2.4 => 1.2.4
@tarojs/taro-alipay: 1.2.4 => 1.2.4
@tarojs/taro-h5: 1.2.4 => 1.2.4
@tarojs/taro-swan: 1.2.4 => 1.2.4
@tarojs/taro-weapp: 1.2.4 => 1.2.4
@tarojs/webpack-runner: 1.2.4 => 1.2.4
eslint-config-taro: 1.2.4 => 1.2.4
eslint-plugin-taro: 1.2.4 => 1.2.4
npmGlobalPackages:
typescript: 3.4.3

操作系统: mac os 10.14.5
Taro 版本 1.2.4
Node.js 版本 8.12.0
报错平台 weapp

@taro-bot
Copy link

taro-bot bot commented May 22, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

你好,1.2.4 是很老的版本了,建议先更新一下 Taro 到 1.2.26,敢于尝试的话可以试试 1.3.0-beta.3

如果你是想在 usingComponents 里使用来自 npm 的原生组件的话,Taro 暂时还不支持,可以选择下载到本地目录使用相对路径的方式

import { Location } from 'fantuan-platform-miniprogram';

class Index extends Taro.Component {
  public config: Taro.Config {
	usingComponents: {
	  // 'Location': 'fantuan-platform-miniprogram' // 暂不支持 npm 方式
	  'Location': 'path/to/the/custom/component',
	}
  }
}

export default Index as ComponentType;

如果是其他方式建议表达清楚一些,然后等待官方解答吧。

@shenghanqin
Copy link
Collaborator

@MuJinYan 可以尝试最新版本。

@taro-bot
Copy link

taro-bot bot commented Nov 18, 2019

CC @luckyadam

@taro-bot
Copy link

taro-bot bot commented Nov 18, 2019

Hello~

您的问题所提供的信息不足,我们无法定位到具体的问题。如果有空的话还请拔冗提供更具体的信息,否则这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Dec 3, 2019
@taro-bot taro-bot bot closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants