gpt4 book ai didi

node.js - Ionic 3 Cordova android 构建未显示在平台文件夹中,权限错误

转载 作者:太空宇宙 更新时间:2023-11-03 17:06:36 24 4
gpt4 key购买 nike

所以我有一个需要为 android 构建的应用程序,但要运行

ionic cordova prepare android

在命令提示符下给出以下错误

(node:2775) UnhandledPromiseRejectionWarning: CordovaError: Failed tofetch platform cordova-android@7.0.0 Probably this is either aconnection problem, or platform spec is incorrect. Check yourconnection and platform name/version/URL. Error: npm: Command failedwith exit code 254 Error output: npm WARN checkPermissions Missingwrite access to/home/{{MYNAME}}/dirname/project-name/node_modules/com-plugins-atcameranpm WARN @ngx-translate/http-loader@3.0.1 requires a peer of@ngx-translate/core@>=10.0.0 but none is installed. You must installpeer dependencies yourself. npm WARN @ngx-translate/http-loader@3.0.1requires a peer of @angular/core@>=6.0.0-rc.0 but none is installed.You must install peer dependencies yourself. npm WARN@ngx-translate/http-loader@3.0.1 requires a peer of@angular/common@>=6.0.0-rc.0 but none is installed. You must installpeer dependencies yourself. npm WARN ajv-keywords@2.1.1 requires apeer of ajv@^5.0.0 but none is installed. You must install peerdependencies yourself. npm WARN ionic-gallery-modal@0.2.7 requires apeer of @angular/core@^4.1.3 but none is installed. You must installpeer dependencies yourself. npm WARN ionic-gallery-modal@0.2.7requires a peer of ionic-angular@3.6.0 but none is installed. You mustinstall peer dependencies yourself.

npm ERR! path/home/{{MYNAME}}/gt-Hub/gt-hub-app-pwa/node_modules/com-plugins-gtcameranpm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall access npmERR! enoent ENOENT: no such file or directory, access'/home/{{MYNAME}}/gt-Hub/project-name/node_modules/com-plugins-atcamera'npm ERR! enoent This is related to npm not being able to find a file.npm ERR! enoent

接着是一些类似的错误,然后是一些 linting 错误

我之前运行过以下命令来修复另一个关于权限的错误

sudo chmod -R 777 /usr/local/lib/node_modules/cordova

sudo chown -R username ~/.config/configstore/update-notifier-cordova.json

sudo chown -R mehulthanki /usr/local/lib/node_modules/cordova

最后修复上面的命令

sudo chmod -R 777 usr

我认为我在尝试修复之前的另一个错误时弄乱了文件的所有权和权限,这可能是由于 ionic 和 cordova 是用 sudo 安装的,实际上你修复了我运行上面提到的最后一个 chmod 命令,所以我可以卸载所有东西:node、npm、ionic 和 cordova,然后在没有 sudo 的情况下重新安装 ionic 和 cordova,但现在还有其他错误..

知道如何解决权限和所有权问题吗?

编辑试跑中

sudo ionic cordova prepare android

报错

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

最佳答案

首先卸载 Cordova,然后使用 NVM( Node 版本管理器)在没有 sudo 的情况下正确安装 Node 和 Cordova。一开始处理 NVM 很烦人,但后来一切都好了。

然后创建一个新的 cordova 项目,而不是试图修复你搞砸的项目。如果您甚至无法安装 cordova-android,则该应用程序将无法运行,在正确安装 cordova-android 之前,请不要尝试任何操作,没有任何错误或警告。

关于node.js - Ionic 3 Cordova android 构建未显示在平台文件夹中,权限错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51282847/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com