Unable to set up backend for In app purchases - in-app-purchase

I have written the cloud functions as per this https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#0. In the section 10, to verify the purchases a 3rd party Javascript called node-apple-receipt-verify is used. I have added this package in the package.json like this
"dependencies": {
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1",
"node-apple-receipt-verify": "^1.9.3"
},
"devDependencies": {
"#types/node-apple-receipt-verify": "^1.7.0",
"#typescript-eslint/eslint-plugin": "^3.9.1",
"#typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^3.8.0"
},
Also added the package in the package-lock.json file
In dependencies
"#types/node-apple-receipt-verify": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/#types/node-apple-receipt-verify/-/node-apple-receipt-verify-1.7.0.tgz",
"integrity": "sha512-hjFcvGgA4h14V3M6XPrp5kJU1HHnIsMamME7Bz3TK7w8IcQrEc9b4wm5/p3Tng38oCwxMvDsozVnLEvitvXlkw==",
"dev": true
},
But I am getting this error
src/app-store.purchase-handler.ts:3:37 - error TS2307: Cannot find module 'node-apple-receipt-
verify' or its corresponding type declarations.
3 import * as appleReceiptVerify from "node-apple-receipt-verify";
src/app-store.purchase-handler.ts:10:16 - error TS2664: Invalid module name in augmentation,
module 'node-apple-receipt-verify' cannot be found.
10 declare module "node-apple-receipt-verify" {
~~~~~~~~~~~~~~~~~~~~~~~~~~~

You need to install the node.js package here.

Related

Migrating ngFileSaver from bower to node package breaks

I have an Angular 1.6 project which did build using:
node 10.16.0
bower 1.8.14
gulp 3.9.1
and with the command sequence:
npm install
bower install
gulp
It now breaks at the bower install step with the file-saver.js#~1.20150507.2 throwing error:
Failed to execute "git ls-remote --tags --heads https://github.com/Teleborder/FileSaver.js.git", exit code of #128
Because of this, I have removed the line
"angular-file-saver": "^1.1.3"
from the bower.json file (bower uninstall did not work for that package) and installed the angular-file-saver package via
npm install angular-file-saver --save-dev
So now the package.json looks like this:
{
"name": "app",
"version": "1.0.0",
"description": "app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"app"
],
"author": "me",
"license": "ISC",
"devDependencies": {
"angular-file-saver": "^1.1.3",
"del": "^2.2.2",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^1.5.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^2.0.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-cheerio": "^0.6.2",
"gulp-clean-css": "^2.2.2",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^4.0.0",
"gulp-flatten": "^0.3.1",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-rev": "^7.1.2",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-string-replace": "^0.3.1",
"gulp-uglify": "^2.0.0",
"main-bower-files": "^2.13.1",
"natives": "^1.1.6",
"require-dir": "^0.3.1",
"rimraf": "^2.6.2",
"stream-series": "^0.1.1",
"uglify-save-license": "^0.4.1",
"yargs": "^6.5.0"
},
"dependencies": {
"bower": "^1.8.4"
}
}
My src\app.js contains this:
(function(angular) {
'use strict';
angular
.module('app', [
'angular-cache',
'ui.router',
'ui.router.modal',
'ui.bootstrap',
'ui.bootstrap-slider',
'ui.validate',
'angular-confirm',
'ngAnimate',
'ngFileSaver',
'angularMoment',
'pascalprecht.translate',
'tmh.dynamicLocale']);
}(window.angular));
And my controller contains this:
angular
.module('app')
.component('readings', {
controllerAs: 'vm',
templateUrl: 'readings/readings.html',
controller: ReadingsController
});
function ReadingsController(..., FileSaver, ...) {
So, now this command sequence works:
npm install
bower install
gulp
But I get this error in the browser
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module ngFileSaver due to:
Error: [$injector:nomod] Module 'ngFileSaver' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.0/$injector/nomod?p0=ngFileSaver
How can I get this package working via npm instead of bower?

Rails Webpacker React: /bin/webpack-dev-server The command moved into a separate package: #webpack-cli/serve

Today I create a fresh Rails webpacker app with command:
$ rails new my-app --webpacker=react -d mysql
The fresh app generated smoothly until I tried to run:
$ ./bin/webpack-dev-server
The webpack-cli return a message:
The command moved into a separate package: #webpack-cli/serve
Would you like to install serve? (That will run yarn add -D #webpack-cli/serve) (yes/NO) :
I tried to select yes but the installation of webpack-cli is not success with message:
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ #webpack-cli/serve#1.5.2
info All dependencies
└─ #webpack-cli/serve#1.5.2
Done in 2.11s.
TypeError: Class constructor ServeCommand cannot be invoked without 'new'
at runWhenInstalled (/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)
at /home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:124:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
and when I run ./bin/webpack-dev-server command I get error messages:
/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:46
return func(...args);
^
TypeError: Class constructor ServeCommand cannot be invoked without 'new'
at runWhenInstalled (/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)
at promptForInstallation (/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:140:10)
at /home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/cli.js:32:43
at Object.<anonymous> (/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
Here is my package.json:
{
"name": "my-app",
"private": true,
"dependencies": {
"#babel/preset-react": "^7.14.5",
"#rails/actioncable": "^6.0.0",
"#rails/activestorage": "^6.0.0",
"#rails/ujs": "^6.0.0",
"#rails/webpacker": "5.4.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"turbolinks": "^5.2.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^4.0.0"
}
}
and my node.js version
$ node -v
v14.17.5
For now, temporarily I solve it by using the previous version:
"devDependencies": {
"webpack-dev-server": "^3.11.2"
}
Update:
The webpack-cli & webpack-dev-server at devDependencies of fresh package.json generated by using rails new my-app --webpacker=react are:
"dependencies": {
...
"webpack-cli": "^3.3.12"
...
},
"devDependencies": {
"webpack-dev-server": "^4.0.0"
}
If we see from here, we found that webpack-dev-server v.4.0.0 depends on "webpack-cli": "^4.7.2" which is incompatible with fresh rails webpacker package configurations that use "webpack-cli": "^3.3.12" as dependency.
Usually we can check webpack-cli info by using command npx webpack-cli info. But now when I try, I got an error and found a warning:
$ npx webpack-cli info
...
warning " > #webpack-cli/info#1.3.0" has incorrect peer dependency "webpack-cli#4.x.x".
...
TypeError: Class constructor InfoCommand cannot be invoked without 'new'
at runWhenInstalled (/home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)
at /home/yohanes/Projects/my-app/node_modules/webpack-cli/bin/utils/prompt-command.js:124:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
...
For now, the only configurations that work with my environment only:
"dependencies": {
...
"webpack-cli": "^3.3.12"
...
},
"devDependencies": {
"webpack-dev-server": "^3.11.2"
}
Update:
Please see DHH comment here
Case close.

Webpack Compile: Cannot find module '#babel/preset-env' when deploy production

i use capistrano to deploy my rails project( Rails 6.0.0, Ruby 2.6.0)
i get bellow log when start `bundle exec cap production deploy
ERROR in ./app/javascript/packs/application.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '#babel/preset-env'
and
ERROR in ./app/javascript/packs/server_rendering.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '#babel/preset-env'
But when i test in local RAILS_ENV=production bundle exec rails assets:precompile . It built successful
my package.json
{
"name": "my_app_name",
"private": true,
"dependencies": {
"#babel/preset-react": "^7.0.0",
"#rails/actiontext": "^6.0.0",
"#rails/webpacker": "^4.0.2",
"axios": "^0.19.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"core-js": "2",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react_ujs": "^2.6.0",
"trix": "^1.0.0",
"webpack-dev-server": "^3.3.1"
},
"devDependencies": {
"#babel/preset-env": "^7.7.6",
"babel-preset-env": "^1.7.0",
"webpack-dev-server": "^3.3.1"
}
}
my app/javascript/packs/application.js
// Support component names relative to this directory:
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
my app/javascript/packs/server_rendering.js
// By default, this pack is loaded for server-side rendering.
// It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
any solution? Thank You
Anything you want available when compiling in production mode needs to be in dependencies. Move #babel/preset-env out of devDependencies into dependencies in package.json. You can also delete babel-preset-env since that is redundant.

I have a error Angular material, run project

I am starting with angular material, I have a test project but I have not been able to run it.
Due to the following error:
When issuing the ng s command the following error appears
ERROR in
node_modules/#angular/material/button-toggle/typings/button-toggle.d.ts(181,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/button/typings/button.d.ts(32,44):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/checkbox/typings/checkbox.d.ts(142,43):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/chips/typings/chip-input.d.ts(66,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/chips/typings/chip-list.d.ts(203,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/chips/typings/chip-list.d.ts(205,27):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/chips/typings/chip-text-control.d.ts(19,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/expansion/typings/expansion-panel-header.d.ts(55,43):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/input/typings/input.d.ts(108,21): error
TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/list/typings/selection-list.d.ts(138,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/menu/typings/menu-item.d.ts(36,43):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/menu/typings/menu-trigger.d.ts(103,43):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/radio/typings/radio.d.ts(198,21): error
TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/select/typings/select.d.ts(334,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/slide-toggle/typings/slide-toggle.d.ts(109,21):
error TS2304: Cannot find name 'FocusOptions'.
node_modules/#angular/material/slider/typings/slider.d.ts(87,21):
error TS2304: Cannot find name 'FocusOptions'.
I have removed my node_modules, I have installed angular cli angular cdk I have removed and reinstalled it and nothing works, I have updated the dependencies and nothing.
Commands I have used
ng update #angular/cli #angular/core
npm install -g #angular/cli
npm uninstall -g #angular/cli
npm install -g #angular/cli #latest
npm install --save #angular/material #angular/cdk
None of this seems to work.
My versions according to the Package.json
{
"name": "angular-material-lab",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^6.1.0",
"#angular/cdk": "^8.2.1",
"#angular/common": "^6.1.0",
"#angular/compiler": "^6.1.0",
"#angular/core": "^6.1.0",
"#angular/forms": "^6.1.0",
"#angular/http": "^6.1.0",
"#angular/material": "^8.2.1",
"#angular/platform-browser": "^6.1.0",
"#angular/platform-browser-dynamic": "^6.1.0",
"#angular/router": "^6.1.0",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"rxjs": "^6.5.3",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.7.0",
"#angular/cli": "~6.1.4",
"#angular/compiler-cli": "^6.1.0",
"#angular/language-service": "^6.1.0",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
I need help I want to test a component of angular material
Had the same issue, solved it by updating package.json with the following angular material versions and running npm install.
"#angular/core": "^7.2.15",
"#angular/animations": "^7.2.15",
"#angular/material": "^7.3.3",
"#angular/cdk": "^7.3.7",
I got this solution from here.
let me know if this works for you.
The real issue what i had faced was the mismatch of the angular core
version and angular material version once i changed it to same it
worked like charm. The error probably comes from the fact that you
have #angular/material set to 6.0.0, but all your other Angular
packages are at 5.x. You should always make sure that the Material
major version matches the major version of Angular.
i had to Open my package.json file
"dependencies": {
"#angular/core": "^6.1.0",
"#angular/cdk": "^8.2.1",
"#angular/material": "^8.2.1"
},
just change these to whatever the current version of the other angular components are.
"dependencies": {
"#angular/core": "^6.1.0",
"#angular/cdk": "^6.1.0",
"#angular/material": "^6.1.0"
},
Try using the commands below:
npm install #angular/cdk#6.0.0
npm install #angular/material#6.0.0
npm install #angular/animation#6.0.0
solve my issue for angular 6

React/RCTDefines.h file not found in RCTBridgeModule.h

I was using Expo and I separated expo eject for module use.
And I tried pod install in iOS file. it was work.
Pod installation complete! There are 51 dependencies from the Pod file
and 63 total pods installed.
But An error occurred when the Xcode was opened and the build and run button was pressed.
package.json:
{
"name": "testgame",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-cli": "6.26.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-es2015": "6.24.1",
"jest-expo": "27.0.0",
"react-native-scripts": "1.14.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^8.1.0",
"bignumber.js": "^8.1.1",
"crypto-browserify": "^3.12.0",
"eth-lightwallet": "^3.0.1",
"ethereumjs-tx": "^1.3.7",
"ethereumjs-util": "^6.0.0",
"ethereumjs-wallet-react-native": "^0.6.7",
"expo": "^30.0.0",
"expokit": "^1.8.0",
"formik": "^1.3.2",
"js-sha3": "^0.8.0",
"native-base": "^2.8.2",
"node-libs-browser": "2.1.0",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
"react-native-confirmation-code-input": "^1.0.4",
"react-native-fast-crypto": "^1.8.1",
"react-native-fetch-blob": "git+https://github.com/HCL-HO/react-native-fetch-blob-expo.git",
"react-native-fs": "^2.13.3",
"react-native-keychain": "^3.1.2",
"react-native-pin-view": "^2.2.1",
"react-native-secure-randombytes": "^3.0.0",
"react-native-touch-id": "^4.4.1",
"react-navigation": "3.0.4",
"web3": "1.0.0-beta.34",
"yup": "^0.26.6"
}
}
Xcode Version: 10.2.1
I've never used Xcode before, so I'm a beginner. Please explain it in detail. I'd appreciate it if you could explain it with a screenshot.
I made a podsec myself and solved it.
This is not in the official document and requires a fundamental solution from the module developer.
This solution creates a lot of Warning. There's nothing wrong with the code.
Remove react-native-secure-randombytes path from Header Search Path
Unlink react-native-secure-randombytes module - react-native unlink react-native-secure-randombytes
Added react-native-secure-randombytes.podspec from this link
Added next code into pod file:
pod 'react-native-secure-randombytes', :path =>
'../node_modules/react-native-secure-randombytes'
do `pod install'

Resources