我是Nativescript的新手,除了Web应用程序之外,我没有移动经验。我正在尝试将GSAP导入NativeScript Angular项目。 Intellij Idea没有抱怨import语句,但是tns找不到模块。
import { TweenLite } from "gsap";
并且来自控制台的错误是
Error: com.tns.NativeScriptException: Failed to find module: "gsap", relative to: app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:146)
com.tns.Module.resolvePath(Module.java:55)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:624)
com.tns.Runtime.run(Runtime.java:616)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5755)
android.app.ActivityThread.-wrap1(Unknown Source:0)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:164)
android.app.ActivityThread.main(ActivityThread.java:6518)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
文件:“,行:1,列:265
和package.json文件是
{
"nativescript": {
"id": "org.nativescript.nslearn",
"tns-android": {
"version": "5.2.0"
},
"tns-ios": {
"version": "5.2.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"src/**/*.ts\""
},
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/http": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"gsap": "^2.1.1",
"nativescript-angular": "~7.2.1",
"nativescript-theme-core": "~1.0.4",
"ng-packagr": "^4.7.1",
"reflect-metadata": "~0.1.12",
"rxjs": "~6.3.0",
"tns-core-modules": "~5.2.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "~7.2.0",
"@nativescript/schematics": "~0.5.0",
"@ngtools/webpack": "~7.2.0",
"codelyzer": "~4.5.0",
"nativescript-dev-sass": "~1.6.0",
"nativescript-dev-typescript": "~0.8.0",
"nativescript-dev-webpack": "~0.20.0",
"tslint": "~5.11.0"
},
"gitHead": "36e279acd3e8bc27395256a32dec1bc9523489ae",
"readme": "NativeScript Application"
}
我也无法导入任何其他npm模块。请帮助我解决此问题。