gpt4 book ai didi

npm - 'npm 错误!无法从 "android"安装,因为它不包含 package.json 文件。\n' +

转载 作者:行者123 更新时间:2023-12-05 08:15:58 27 4
gpt4 key购买 nike

我无法执行下面的命令,并且根据主题标题出现错误。请帮助

ionic cordova平台添加android ionic Cordova 添加安卓 ionic Cordova 准备安卓

S C:\Users\jj\Desktop\bento academy\Bentograms> ionic cordova platform add android

cordova.cmd platform add android Error: npm: Command failed with exit code 1 Error output: npm ERR! code ENOLOCAL npm ERR! Could notinstall from "android" as it does not contain a package.json file.

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
C:\Users\jj\AppData\Roaming\npm-cache_logs\2020-07-31T14_53_29_466Z-debug.log在 ChildProcess.whenDone(C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\superspawn.js:135:23)在 ChildProcess.emit(events.js:315:20)在 ChildProcess.cp.emit(C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cross-spawn\lib\enoent.js:34:29)在 maybeClose (internal/child_process.js:1021:16)在 Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) { stderr: 'npm ERR!代码ENOLOCAL\n' +'npm 错误!无法从“android”安装,因为它不包含 package.json 文件。\n' +'\n' +'npm 错误!可以在以下位置找到此运行的完整日志:\n' +'npm 错误! C:\Users\jj\AppData\Roaming\npm-cache\_logs\2020-07-31T14_53_29_466Z-debug.log\n',code: 1 } [ERROR] 运行子进程 cordova 时发生错误。

PS C:\Users\jj\Desktop\bento academy\Bentograms> ionic cordova prepare android?未安装平台android!您想安装它吗?是的

cordova.cmd platform add android --saveError: npm: Command failed with exit code 1 Error output:npm ERR! code ENOLOCALnpm ERR! Could not install from "android" as it does not contain a package.json file.

npm 错误!可以在以下位置找到此运行的完整日志:错误! C:\Users\jj\AppData\Roaming\npm-cache_logs\2020-07-31T14_32_53_529Z-debug.log在 ChildProcess.whenDone(C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\superspawn.js:135:23)在 ChildProcess.emit(events.js:315:20)在 ChildProcess.cp.emit(C:\Users\jj\AppData\Roaming\npm\node_modules\cordova\node_modules\cross-spawn\lib\enoent.js:34:29)在 maybeClose (internal/child_process.js:1021:16)在 Process.ChildProcess._handle.onexit(内部/child_process.js:286:5){标准错误:'npm 错误!编码 ENOLOCAL\n' +'npm 错误!无法从“android”安装,因为它不包含 package.json 文件。\n' +'\n' +'npm 错误!可以在以下位置找到此运行的完整日志:\n' +'npm 错误! C:\Users\jj\AppData\Roaming\npm-cache\_logs\2020-07-31T14_32_53_529Z-debug.log\n',

这是我的 package.json 文件

{
"name": "Bentograms",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~9.1.6",
"@angular/core": "~9.1.6",
"@angular/fire": "^6.0.2",
"@angular/forms": "~9.1.6",
"@angular/platform-browser": "~9.1.6",
"@angular/platform-browser-dynamic": "~9.1.6",
"@angular/router": "~9.1.6",
"@capacitor/android": "^2.3.0",
"@capacitor/core": "2.3.0",
"@ionic-native/camera": "^5.27.0",
"@ionic-native/core": "^5.0.7",
"@ionic-native/facebook": "^5.27.0",
"@ionic-native/file": "^5.27.0",
"@ionic-native/file-path": "^5.27.0",
"@ionic-native/google-plus": "^5.27.0",
"@ionic-native/ionic-webview": "^5.27.0",
"@ionic-native/native-storage": "^5.22.0-beta-1",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
"@ionic/storage": "^2.3.0",
"cordova-browser": "^6.0.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-facebook4": "^6.4.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-googleplus": "^8.5.0",
"cordova-plugin-nativestorage": "^2.3.2",
"exif-js": "^2.3.0",
"firebase": "^7.16.0",
"rxjs": "~6.5.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.5",
"@angular/cli": "~9.1.5",
"@angular/compiler": "~9.1.6",
"@angular/compiler-cli": "~9.1.6",
"@angular/language-service": "~9.1.6",
"@capacitor/cli": "2.3.0",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.871006065561-1u6n3q4iav5486cjc1kg3djl7410p873"
},
"cordova-plugin-nativestorage": {},
"cordova-plugin-camera": {},
"cordova-plugin-file": {}
}
}
}

最佳答案

删除根目录下的“android”文件夹。

再次运行命令:

ionic cordova platform add android

关于npm - 'npm 错误!无法从 "android"安装,因为它不包含 package.json 文件。\n' +,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63194673/

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