【发布时间】:2020-11-07 07:05:25
【问题描述】:
在 nativescript vue.js 项目中,我通过 npm install nativescript-oauth2 安装了 nativescript-oauth2。
稍后我尝试通过import { TnsOAuthClient, configureTnsOAuth } from 'nativescript-oauth2';将nativescript-oauth2包导入项目文件。
当我构建应用程序时,出现以下错误。
ERROR in ./auth/auth-service.js
Module not found: Error: Can't resolve 'nativescript-oauth2' in 'C:\repo\digitaltjagttegn-mobileapp\app\auth'
@ ./auth/auth-service.js 2:0-72
@ . sync (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|kt|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$
@ ./main.js`
如果有人能给我一些如何处理它的提示,我会很棒
我已删除 hooks、platforms 和 node_modules 文件夹并以相同的结果重建。
例如 import { isAndroid, isIOS } from 'tns-core-modules/platform'; 在同一个文件中运行良好。
提前感谢您的帮助。
【问题讨论】:
-
根据文档,您需要使用 npm install nativescript-oauth2 --save github.com/alexziskind1/nativescript-oauth2#setup
-
我已经用 npm install nativescript-oauth2 --save 安装了 nativescript-oauth2 --save 在项目的新副本上,结果是一样的。
-
随意跳到 NativeScript Slack。
-
我也遇到了同样的问题
-
我在 nativescript-oauth2 存储库中创建了一个问题:github.com/alexziskind1/nativescript-oauth2/issues/126
标签: import nativescript nativescript-vue nativescript-oauth2