проблема с добавлением платформы iOS в проект ionic cordova - PullRequest
0 голосов
/ 09 июля 2019

Я новичок в фреймворке ionic cordova и у меня проблема.Я получил проект от коллеги и должен создать его за ios.Сразу при создании платформы iOS возникают ошибки:

Heikos-MacBook-Pro:project_app premox$ ionic cordova build ios --prod
Using cordova-fetch for cordova-ios@4.5.5
Adding ios project...
Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: com.project
    Name: Project.com
iOS project created with cordova-ios@4.5.5
Installing "cordova-plugin-add-swift-support" for ios
Installing "cordova-plugin-android-permissions" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-globalization" for ios
Installing "cordova-plugin-inappbrowser" for ios
Installing "cordova-plugin-ionic-webview" for ios
Installing "cordova-plugin-ios-camera-permissions" for ios
Installing "cordova-plugin-qrscanner" for ios
Plugin dependency "cordova-plugin-add-swift-support@1.7.2" already fetched, using that version.
Dependent plugin "cordova-plugin-add-swift-support" already installed on ios.
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "ionic-plugin-keyboard" for ios
Discovered saved plugin "cordova-sqlite-storage". Adding it to the project
Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/Users/premox/Documents/projects/project_app/plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js:13:21)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Failed to restore plugin "cordova-sqlite-storage" from config.xml. You might need to try adding it again. Error: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Discovered saved plugin "cordova-plugin-statusbar". Adding it to the project
Installing "cordova-plugin-statusbar" for ios
Adding cordova-plugin-statusbar to package.json
Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You might need to try adding it again. Error: Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.

        cordova platform add ios --save exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Я повторил вызов с --verbose и получил следующее сообщение об ошибке:

Heikos-MacBook-Pro:project_app premox$ ionic cordova build ios --prod --verbose
  ionic:lib Terminal info: { tty: true, ci: false, windows: false } +0ms
  ionic:lib CLI global options: { _: [ 'cordova', 'build', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, prod: true, project: null, '--': [] } +10ms
  ionic:lib:project Project type from config: Ionic 2/3 (ionic-angular) +0ms
  ionic:lib:project Project details: { configPath: '/path/to/project/ionic.config.json', errors: [], context: 'app', type: 'ionic-angular' } +0ms
  ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/path/to/project', version: '4.12.0' } +0ms
  ionic:lib:integrations:cordova:config Using config.xml: /path/to/project/config.xml +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic cordova build' [ 'ios', '--prod', '--verbose', '--interactive', '--color' ] +0ms
  ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:lib:project:ionic-angular:build Looking for ionic:build npm script. +0ms
  ionic:lib:project:ionic-angular:build Found ionic:build, but it is the default. Not running. +13ms
> ionic-app-scripts build --prod --target cordova --platform ios
/path/to/project/node_modules/node-sass/lib/binding.js:13
      throw new Error(errors.unsupportedEnvironment());
      ^

Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (72)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.5.3
    at module.exports (/path/to/project/node_modules/node-sass/lib/binding.js:13:13)
    at Object.<anonymous> (/path/to/project/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/path/to/project/node_modules/@ionic/app-scripts/dist/core/bundle-components.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

        ionic-app-scripts build --prod --target cordova --platform ios exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:utils-process onBeforeExit handler: process.exit received +0ms
  ionic:utils-process onBeforeExit handler: running 1 functions +1ms
  ionic:utils-process onBeforeExit handler: exiting (exit code 1) +71ms

Я не совсем понимаю эту ошибкусообщение.Что это значит и как я могу это исправить?

EDIT

Я удалил плагин cordova-sqlite-storage, хотел переустановить его и получил следующее сообщение:

Heikos-MacBook-Pro:project_app premox$ ionic cordova plugin rm cordova-sqlite-storage
> cordova plugin remove cordova-sqlite-storage --save
Uninstalling cordova-sqlite-storage from ios
Removing "cordova-sqlite-storage"
Removing cordova-sqlite-storage from package.json
Heikos-MacBook-Pro:project_app premox$ cordova plugin add cordova-sqlite-storage@latest
^C
Heikos-MacBook-Pro:project_app premox$ ionic cordova plugin add cordova-sqlite-storage@latest
> cordova plugin add cordova-sqlite-storage@latest --save
Installing "cordova-sqlite-storage" for ios
installing external dependencies via npm
for package name: cordova-sqlite-storage
npm install of external dependencies ok
Adding cordova-sqlite-storage to package.json
Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.

        cordova plugin add cordova-sqlite-storage@latest --save exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

1 Ответ

1 голос
/ 09 июля 2019

Это потому, что вы используете Cordova 9, модуль q теперь не поддерживается в Cordova 9.

У вас есть 2 решения:

Попробуйте обновить вашу Cordova-sqlite-Storage до последней версии.

Или понизьте версию Cordova до 8.

npm install -g cordova@8.1.1
...