json - npm 错误!在netbeans中使用cordova时编码ENOPACKAGEJSON
问题描述
我正在尝试让科尔多瓦与 netbeans 一起运行。我不断收到错误消息,
我创建了一个由netbeans提供的helloworld html5应用程序,我下载了android studios、node.js、git和cordova,并设置了路径。当我在命令行中检查 git 和 cordova 的版本时,一切都很好。请指教。 报错信息截图
check-android-template:
check-cordova-version:
check-cordova-project:
upgrade-to-cordova-project:
create-android:
update-plugins:
cordova.cmd plugins
cordova.cmd -d plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git"
fetch: Installing https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git to C:\Users\SONY\Documents\NetBeansProjects\HTML5Application
Running command: npm install https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git --production --save
Failed to fetch plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git via registry.Command finished with error code 1: npm install,https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git,--production,--save
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\SONY\AppData\Roaming\npm-cache\_logs\2019-08-10T17_29_09_382Z-debug.log
CordovaError: Failed to fetch plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\SONY\AppData\Roaming\npm-cache\_logs\2019-08-10T17_29_09_382Z-debug.log
at C:\Users\SONY\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:146:43
at processTicksAndRejections (internal/process/task_queues.js:85:5)
C:\Users\SONY\Documents\NetBeansProjects\HTML5Application\nbproject\build.xml:235: exec returned: 1
BUILD FAILED (total time: 48 seconds)
解决方案
看起来您正在尝试在npm install
没有package.json的情况下运行。
如果没有任何方法来重现这些步骤,就不可能知道发生了什么。但是您可以通过运行然后运行或者如果它是一个 Android 应用程序来创建一个package.json 。npm init
npm i -S cordova
npm i -S cordova-android
推荐阅读
- solidity - VM out of Gas Exception 试图调用属于其他合约的函数
- android - BottomNavigationView 不在底部显示,而是在顶部显示
- mongodb - 尝试为 Hyperledger composer 项目启用 JWT 时出错
- java - 在 Redis 中存储 Web Socket 会话
- angular - Angular 无法分配给只读属性
- javascript - 如何将外部 js 文件集成到 Angular 6 中。特别是将 Angular 质粒集成到 Angular 6 中
- php - 无法通过 XAMMP 使用 PHP 连接到 Oracle Database 11g
- php - 使用 CURL 向 SSL 认证域发送 post 请求
- php - 无法在 Excel::load() 之外获取对象名称值
- ajax - 如何更改日期格式 Ajax codeigniter 记录列表..?