问题
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.
My code:
import * as ImageModule from "tns-core-module/ui/image";
What am I supposed to do now? How can I fix this?
My npm --version
: 3.10.10
My node -v
: v6.11.1
My TS-Version: 2.4.2
The tns-core-modules
are Version 2.2.1
in my package.json
回答1:
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.
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";
来源:https://stackoverflow.com/questions/45814066/cannot-find-any-tns-core-module-ui-modules-nativescript