找不到任何tns-core-module/ui模块NativeScript [英] Cannot find any tns-core-module/ui Modules NativeScript

查看:72
本文介绍了找不到任何tns-core-module/ui模块NativeScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个{N} -Application,需要从tns-core-modules/ui/image -module导入图像.可悲的是,他说他无法在tns-core-module中找到该目标.

I am writing a {N}-Application and need to import Images from the tns-core-modules/ui/image-module. Sadly he says that he cannot find that target in the tns-core-module.

我的代码:

import * as ImageModule from "tns-core-module/ui/image";

我现在该怎么办?我该如何解决?

What am I supposed to do now? How can I fix this?

我的npm --version:3.10.10

我的node -v:v6.11.1

我的TS版本:2.4.2

My TS-Version: 2.4.2

tns-core-modules在我的package.json中是Version 2.2.1

The tns-core-modules are Version 2.2.1 in my package.json

推荐答案

您确定提供的路径有效吗?似乎您想相对地引用它,但是如果您想引用它,则可能需要提高一些层次.例如:

Are you sure that the path you provided is valid? It seems like you want to reference it relatively, but you might have to go up a few levels if you are. For instance:

import * as ImageModule from "../tns-core-module/ui/image"; //This will go up two levels.

或者,您也可以使用在tsconfig.json文件中声明的路径导入模块.类似于

Alternatively, you may be able to import the module using a path declared in your tsconfig.json file. Something along the lines of

        "paths": {
        "*": [
            "./node_modules/tns-core-modules/*"
        ]
    }

在这种情况下,您可以简单地通过使用

If that's the case, you can simply import by using

imprt * as ImageModule from "ui/images";

这篇关于找不到任何tns-core-module/ui模块NativeScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆