Sails fails to lift after simple update - javascript

I have a server running on aws elastic beanstalk. It's pretty much been fine. but today when applying an update(Absolutely nothing to do with configs or versioning of modules used) which was simply adding a few words to some text in the web app (Literally the word 'dog'). The app started crashing with 502 nginx gateway errors. I assume this is because the app is not lifying. I went and reverted the change(Though I did not think I had to do so). and the problem persists.
My output when attempting to lift / start the sails app is as follows.
Failed to load helper `web/auth/validate-user-password` as a machine!
A hook (`helpers`) failed to load!
Failed to lift app: ImplementationError: Sorry, could not interpret "web/auth/validate-user-password" because its underlying implementation has a problem:
------------------------------------------------------
• The `cacheable` property is no longer supported. (Please use `sideEffects: 'cacheable' instead.)
------------------------------------------------------
If you are the maintainer of "web/auth/validate-user-password", then you can change its implementation to solve the problem above. Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at flaverr (/var/app/current/node_modules/flaverr/index.js:77:15)
at helpBuildMachine (/var/app/current/node_modules/sails/node_modules/machine/lib/private/help-build-machine.js:127:11)
at Function.build (/var/app/current/node_modules/sails/node_modules/machine/lib/build.js:52:10)
at /var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:51:49
at /var/app/current/node_modules/#sailshq/lodash/lib/index.js:3228:15
at baseForOwn (/var/app/current/node_modules/#sailshq/lodash/lib/index.js:2199:14)
at /var/app/current/node_modules/#sailshq/lodash/lib/index.js:3198:18
at Function.<anonymous> (/var/app/current/node_modules/#sailshq/lodash/lib/index.js:3501:13)
at /var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:37:9
at helpBuildDictionary (/var/app/current/node_modules/sails/node_modules/include-all/lib/help-build-dictionary.js:135:10)
at Function.module.exports.optional (/var/app/current/node_modules/sails/node_modules/include-all/index.js:67:10)
at Hook.loadHelpers (/var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:21:14)
at Hook.initialize (/var/app/current/node_modules/sails/lib/hooks/helpers/index.js:28:19)
at Hook.wrapper [as initialize] (/var/app/current/node_modules/#sailshq/lodash/lib/index.js:3250:19)
at /var/app/current/node_modules/sails/lib/hooks/index.js:88:16
at /var/app/current/node_modules/async/dist/async.js:486:20
(You are seeing the above error message because no custom callback was programmatically provided to `.lift()`.)
A hook (`orm`) failed to load!
This is what I'm seeing in package.json in case it will be of help.
{
"name": "sails-xxxxxxx-seed",
"private": true,
"version": "0.0.3-147",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"async": "2.0.1",
"aws-sdk": "^2.41.0",
"bcryptjs": "2.3.0",
"connect-redis": "3.3.0",
"flaverr": "^1.1.1",
"lodash": "3.10.1",
"machinepack-http": "3.1.2",
"moment-timezone": "0.5.13",
"pdfmake": "0.1.28",
"sails": "^1.0.0-32",
"sails-hook-orm": "^2.0.0-0",
"sails-hook-sockets": "^1.0.1",
"sails-mysql": "^1.0.0-13",
"sails-stdlib": "^0.7.1",
"sails.io.js": "1.1.9",
"serve-static": "1.12.3",
"socket.io-client": "1.7.3",
"socket.io-redis": "3.1.0",
"uuid": "3.0.1"
},
"devDependencies": {
"#angular/animations": "~4.1.3",
"#angular/common": "~4.1.3",
"#angular/compiler": "~4.1.3",
"#angular/compiler-cli": "~4.1.3",
"#angular/core": "~4.1.3",
"#angular/forms": "~4.1.3",
"#angular/http": "~4.1.3",
"#angular/platform-browser": "~4.1.3",
"#angular/platform-browser-dynamic": "~4.1.3",
"#angular/platform-server": "~4.1.3",
"#angular/router": "~4.1.3",
"#angular/upgrade": "~4.1.3",
"#swimlane/ngx-datatable": "^8.0.0",
"#types/jasmine": "^2.5.47",
"#types/node": "^6.0.48",
"angular-pipes": "^6.5.1",
"angular-router-loader": "^0.6.0",
"angular2-in-memory-web-api": "0.0.21",
"angular2-moment": "^1.3.3",
"angular2-template-loader": "^0.6.0",
"angular2-text-mask": "^8.0.1",
"awesome-typescript-loader": "^3.1.2",
"babel-core": "^6.25.0",
"babel-loader": "^7.0.0",
"babel-preset-env": "^1.5.2",
"babel-preset-es2015": "^6.24.1",
"chart.js": "^2.5.0",
"clean-webpack-plugin": "0.1.16",
"clipboard": "^1.6.1",
"copy-webpack-plugin": "4.0.1",
"core-js": "^2.4.1",
"css-loader": "0.27.3",
"debug": "^2.6.8",
"ejs-loader": "0.3.0",
"eslint": "3.19.0",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "^0.11.1",
"glob": "^7.1.1",
"ie-shim": "^0.1.0",
"json2csv": "^3.7.3",
"knex": "0.13.0",
"less": "2.7.2",
"less-loader": "4.0.1",
"mime-types": "2.1.15",
"mocha": "^3.2.0",
"mydatepicker": "^1.9.2",
"ng-sidebar": "^4.1.1",
"ng2-charts": "^1.5.0",
"ng2-table": "^1.3.2",
"ng2-toastr": "^4.0.1",
"ng2-validation": "^4.1.0",
"ngx-bootstrap": "^1.6.6",
"ngx-progressbar": "^2.0.0",
"node-sass": "^4.5.2",
"primeng": "^4.0.0",
"prompt": "1.0.0",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"sass-loader": "^6.0.3",
"semver": "^5.3.0",
"to-string-loader": "^1.1.4",
"typescript": "~2.2.1",
"url-loader": "^0.5.8",
"waterline-utils": "^1.3.12",
"webpack": "^2.2.1",
"webpack-livereload-plugin": "^0.11.0",
"webpack-merge": "^0.15.0",
"webpack-watch-livereload-plugin": "0.0.1",
"zone.js": "~0.6.26"
},
"scripts": {
"start": "NODE_ENV=production node app.js",
"test": "npm run lint && npm run custom-tests && echo 'Done.'",
"lint": "node ./node_modules/eslint/bin/eslint . --max-warnings=0 && echo '✔ Your code looks good.'",
"custom-tests": "echo \"(No other custom tests yet.)\" && echo",
"version": "node -e 'process.stdout.write((require(\"./package.json\").version))'",
"bump": "node scripts/bump.js",
"debug": "node debug app.js",
"deploy-staging": "sails_environment=web_staging npm run bump && sails_environment=web_staging npm run deploy",
"deploy-demo": "sails_environment=web_demo npm run bump && npm run deploy",
"deploy": "cp -r eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && npm run zip && rm .ebbootstrap.sh && node scripts/publish-static-assets && node scripts/deploy-to-eb",
"zip": "mkdir -p .tmp && rm .tmp/deploy.zip &> /dev/null; zip -9 -r --exclude=node_modules/* --exclude=.tmp/* --exclude=.DS_Store --exclude=.git/* --exclude=config/local.js ./.tmp/deploy.zip .",
"deploy-alerts-staging": "sails_environment=alerts_staging npm run bump && sails_environment=alerts_staging npm run deploy-alerts",
"deploy-alerts": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && cp eb/apps/alerts/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-rollup-staging": "sails_environment=rollup_staging npm run bump && sails_environment=rollup_staging npm run deploy-rollup",
"deploy-rollup": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && cp eb/apps/rollup/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-devices-staging": "sails_environment=devices_staging npm run bump && sails_environment=devices_staging npm run deploy-devices",
"deploy-devices": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && npm run zip-backend && rm .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-device-sim": "cp eb/bootstrap/device_sim.sh .ebbootstrap.sh && cp eb/apps/device-sim/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && sails_environment=device_sim npm run bump && sails_environment=device_sim node scripts/deploy-to-eb",
"zip-backend": "mkdir -p .tmp && rm .tmp/deploy.zip &> /dev/null; zip -9 -r --exclude=node_modules/* --exclude=.tmp/* --exclude=.DS_Store --exclude=.git/* --exclude=src/* --exclude=config/local.js ./.tmp/deploy.zip ."
},
"main": "app.js",
"repository": {
"type": "git",
"url": "xxxxxxxxxx.git"
},
"author": "xxxxxx",
"license": ""
}
and below is validate-user-password.js
module.exports = {
friendlyName: 'Validate user password (strict)',
description: 'Strictly validate a string as the potential "password" for a user.',
cacheable: true,
sync: true,
inputs: {
string: {
description: 'The string to validate as a password.',
required: true,
example: 'abcd1234',
}
},
exits: {
success: {
description: 'The specified string is 100% valid.'
},
notValid: {
description: 'The specified string is not a valid password.'
},
},
fn: function (inputs,exits) {
// Coerce
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Since we don't need to support `strict: false` for this validator (it is ALWAYS strict), then we can
// just skip this part. (Also no need for the "notStrictlyValid" exit, output from the success exit,
// or the `strict` input)
//
// n/a
// Validate
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// • Must be long enough.
if (inputs.string.length < 7) {
return exits.notValid(new Error('Password must consist of at least 7 characters.'));
}
// • Must not be too long.
if (inputs.string.length > 72) {
return exits.notValid(new Error('Password must not contain more than 72 characters.'));
}
return exits.success();
}
};

Indeed, it is probably a update in Sails itself that caused that. Did you try the following configuration for validate-user-password.js ?
module.exports = {
friendlyName: 'Validate user password (strict)',
description: 'Strictly validate a string as the potential "password" for a user.',
sideEffects: 'cacheable',
sync: true,
/* ... rest of content ... */
}

I wonder if the issue is related to a change around this time in the version of machine used by Sails core. This normally wouldn't have affected your app unless the semantic version range (SVR) of your Sails dependency was manually increased. But since this app is using a prerelease of Sails v1, it's likely that was the reason this change got picked up downstream.
As #Alexis N-o mentioned, the solution is to instead of using cacheable: true, to use:
sideEffects: 'cacheable'

Related

Invalid Podfile file: "react-native-community/cli" type of error

I am failing to install iOS dependencies using pod install annd after pressing enter button to run pod install.
Node Version: v16.16.0
NPM Version: 8.11.0
Working Process which I followed:
First way to install pod: Firstly install npm then install pod
Second way to install pod: after deleting node_modules then run pod install
Failed to install to follow the both of rules as mentioned before and to check the error, please check the attached file.
The dependencies are install in our projects as given below as package.json file.
{
"name": "shohan",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.16.2",
"#react-native-community/blur": "^3.6.0",
"#react-native-community/cli-platform-ios": "^8.0.6",
"#react-native-community/clipboard": "^1.5.1",
"#react-native-community/datetimepicker": "^6.1.2",
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-native-picker/picker": "^2.4.2",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/material-top-tabs": "^6.2.1",
"#react-navigation/native": "^6.0.8",
"#react-navigation/native-stack": "^6.5.0",
"#rneui/base": "^0.0.0-edge.2",
"#rneui/themed": "^0.0.0-edge.2",
"#twotalltotems/react-native-otp-input": "^1.3.11",
"axios": "^0.26.1",
"moment": "^2.29.2",
"radio-buttons-react-native": "^1.0.4",
"react": "17.0.2",
"react-hook-form": "^7.28.1",
"react-native": "0.67.3",
"react-native-animatable": "^1.3.3",
"react-native-audio-record": "^0.2.2",
"react-native-bar-chart": "^0.1.0",
"react-native-countdown-component": "^2.7.1",
"react-native-date-picker": "^4.2.0",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown-picker": "^5.3.0",
"react-native-elevation": "^1.0.0",
"react-native-emoji-selector": "^0.2.0",
"react-native-fs": "^2.20.0",
"react-native-image-picker": "^4.8.4",
"react-native-infinite-scrolling": "^2.0.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^3.0.0",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.12.1",
"react-native-picker-select": "^8.0.4",
"react-native-pure-chart": "^0.0.24",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^4.1.2",
"react-native-screens": "^3.13.1",
"react-native-skeleton-placeholder": "^5.0.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "^0.11.2",
"react-native-step-indicator": "^1.0.3",
"react-native-super-grid": "^4.4.0",
"react-native-svg": "^12.4.0",
"react-native-swiper-flatlist": "^3.0.16",
"react-native-tab-view": "^3.1.1",
"react-native-text-gradient": "^0.1.7",
"react-native-vector-icons": "^9.1.0",
"react-native-video": "^2.3.1",
"react-native-video-player": "^0.12.0",
"react-native-webview": "^11.18.1",
"react-native-youtube-iframe": "^2.2.2",
"socket.io-client": "^4.5.1"
},
"devDependencies": {
"#babel/core": "^7.17.5",
"#babel/runtime": "^7.17.2",
"#react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^27.5.1",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"metro-react-native-babel-preset": "^0.69.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
Here is the Podfile's code is given below,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'shohan' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'shohanTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
The occurred error is given in the attached file please check it and help me.

angular 13: Module not found: Error: Can't resolve 'rxjs/operators'

I have upgraded my angular to angular 13. when I run to build SSR it gives me following error.
ERROR in ./node_modules/#angular/common/fesm2015/http.mjs 12:0-56
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/nr/aws/jobsaf-website-staging/application/node_modules/#angular/common/fesm2015'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
# ./src/app/app.server.module.ts 6:0-57 16:25-42
# ./src/main.server.ts 3:0-58 3:0-58
# ./server.ts 32:0-52 40:15-30 44:0-34 44:0-34
ERROR in ./node_modules/#angular/core/fesm2015/core.mjs 8:0-39
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/nr/aws/jobsaf-website-staging/application/node_modules/#angular/core/fesm2015'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
# ./server.ts 30:0-47 35:0-14
ERROR in ./node_modules/#angular/forms/fesm2015/forms.mjs 11:0-37
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/nr/aws/jobsaf-website-staging/application/node_modules/#angular/forms/fesm2015'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
# ./src/app/app.module.ts 12:0-45 78:12-23
# ./src/app/app.server.module.ts 3:0-41 12:18-27
# ./src/main.server.ts 3:0-58 3:0-58
# ./server.ts 32:0-52 40:15-30 44:0-34 44:0-34
ERROR in ./node_modules/#angular/platform-server/fesm2015/platform-server.mjs 21:0-39
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/nr/aws/jobsaf-website-staging/application/node_modules/#angular/platform-server/fesm2015'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
# ./src/main.server.ts 4:0-77 4:0-77 4:0-77
# ./server.ts 32:0-52 40:15-30 44:0-34 44:0-34
ERROR in ./node_modules/#angular/router/fesm2015/router.mjs 10:0-180
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/nr/aws/jobsaf-website-staging/application/node_modules/#angular/router/fesm2015'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
# ./src/app/app.component.ts 2:0-48 35:31-44
# ./src/app/app.server.module.ts 2:0-47 13:20-32
# ./src/main.server.ts 3:0-58 3:0-58
# ./server.ts 32:0-52 40:15-30 44:0-34 44:0-34
my package.json file:
{
"name": "admin-panel",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "DEBUG=jobsaf-website:* nodemon --inspect --trace-warnings --legacy-watch --trace-warnings ./bin/www",
"seed": "node ./seeds/static-tables.js",
"test-jobsaf": "mocha --timeout 10000",
"rm-web": "rm -rf ./public/web/*",
"ng": "node ./node_modules/#angular/cli/bin/ng serve --host 0.0.0.0",
"ng:build": "node --max_old_space_size=5048 ./node_modules/#angular/cli/bin/ng build --configuration production --aot",
"build:server:prod": "node --max_old_space_size=4048 ./node_modules/#angular/cli/bin/ng run jobsaf-website:server:prod && webpack --config webpack.server.config.js",
"build:browser:prod": "node --max_old_space_size=4048 ./node_modules/#angular/cli/bin/ng build --configuration production --aot --vendor-chunk --deleteOutputPath=true --buildOptimizer --progress=true",
"build:server:staging": "node --max_old_space_size=4048 ./node_modules/#angular/cli/bin/ng run jobsaf-website:server:staging && webpack --config webpack.server.config.js",
"build:browser:staging": "node --max_old_space_size=4048 ./node_modules/#angular/cli/bin/ng build --configuration production --configuration=staging --aot --vendor-chunk --deleteOutputPath=true --buildOptimizer",
"build:stats": "node --max_old_space_size=3192 node_modules/#angular/cli/bin/ng build --configuration production --aot --vendor-chunk --deleteOutputPath=true --buildOptimizer --progress=true --configuration production --stats-json",
"build:prod": "npm run rm-web && npm run build:server:prod && npm run build:browser:prod",
"build:staging": "npm run rm-web && npm run build:server:staging && npm run build:browser:staging",
"server": "node local.js",
"file:migration": "APP_FILE_MIGRATION=true node ./migration/file-migration.js",
"test_env": "set NODE_ENV=test",
"jest": "jest --detectOpenHandles --watchAll --config ./jest.config.js",
"coverage": "jest -i --coverage",
"jest:ci": "jest --detectOpenHandles --forceExit --config ./jest.config.js",
"test": "npm run test_env && npm run jest",
"test:ci": "npm run test_env && npm run seed && npm run jest:ci",
"dev:ssr": "ng run jobsaf-website:serve-ssr",
"serve:ssr": "node public/web/server/main.js",
"build:ssr": "ng build --configuration production && ng run jobsaf-website:server:prod",
"prerender": "ng run jobsaf-website:prerender",
"postinstall": "ngcc"
},
"private": true,
"napa": {
"jquery.flot.spline": "miloszfalinski/jquery.flot.spline",
"ika.jvectormap": "kakirigi/ika.jvectormap"
},
"dependencies": {
"#angular/animations": "^13.0.2",
"#angular/common": "^13.0.2",
"#angular/compiler": "^13.0.2",
"#angular/compiler-cli": "^13.0.2",
"#angular/core": "^13.0.2",
"#angular/forms": "^13.0.2",
"#angular/material": "^13.0.2",
"#angular/platform-browser": "^13.0.2",
"#angular/platform-browser-dynamic": "^13.0.2",
"#angular/platform-server": "^13.0.2",
"#angular/pwa": "^13.0.3",
"#angular/router": "^13.0.2",
"#angular/service-worker": "^13.0.2",
"#fortawesome/angular-fontawesome": "^0.10.1",
"#fortawesome/fontawesome-svg-core": "^1.2.36",
"#fortawesome/free-brands-svg-icons": "^5.15.4",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fullcalendar/core": "^5.10.1",
"#hapi/joi": "^15.1.0",
"#ng-select/ng-select": "^8.1.1",
"#nguniversal/common": "^13.0.1",
"#nguniversal/express-engine": "^13.0.1",
"#ngx-loading-bar/core": "^5.1.2",
"#ngxs/store": "^3.7.3-dev.master-1e7127b",
"#schematics/angular": "^13.0.3",
"#sindresorhus/slugify": "^1.1.0",
"#trademe/ng-defer-load": "^8.2.1",
"#types/jquery": "^3.5.8",
"angular-archwizard": "^7.0.0",
"angular2-uuid": "^1.1.1",
"apicache": "^1.6.3",
"archiver": "^5.3.0",
"aws-sdk": "^2.1031.0",
"bluebird": "^3.7.2",
"bootstrap": "5.1.3",
"compression": "^1.7.4",
"compromise": "^13.11.4",
"cookie-parser": "^1.4.6",
"core-js": "3.19.1",
"cors": "~2.8.5",
"debug": "^4.3.2",
"dotenv": "^10.0.0",
"easyimage": "^3.1.1",
"ejs": "^3.1.6",
"exceljs": "^4.3.0",
"express": "^4.17.1",
"express-jwt": "^6.1.0",
"express-mongo-sanitize": "^2.1.0",
"express-rate-limit": "^5.5.1",
"express-useragent": "^1.0.15",
"express-validator": "^6.13.0",
"feed": "^4.2.2",
"file-saver": "^2.0.5",
"firebase-admin": "^10.0.0",
"font-awesome": "^4.7.0",
"generate-password": "^1.7.0",
"google-auth-library": "^7.10.2",
"hammerjs": "^2.0.8",
"helmet": "^4.6.0",
"html-pdf": "^3.0.1",
"http-status": "^1.5.0",
"intl-tel-input": "^17.0.13",
"izitoast": "1.4.0",
"joi-objectid": "^4.0.2",
"jquery": "^3.6.0",
"jsonwebtoken": "^8.5.1",
"jwt-decode": "^3.1.2",
"keyword-extractor": "0.0.20",
"kickbox": "^2.0.4",
"libphonenumber-js": "^1.9.43",
"localstorage-polyfill": "^1.0.1",
"lodash": "^4.17.21",
"lodash.uniq": "^4.5.0",
"md5": "^2.3.0",
"moment": "^2.29.1",
"mongoose": "5.8.11",
"mongoose-history": "^0.8.0",
"mongoose-unique-validator": "^2.0.3",
"mongoose-url-slugs": "^1.0.2",
"multer": "^1.4.3",
"multer-s3": "^2.10.0",
"multer-s3-transform": "^2.10.3",
"mysql": "^2.18.1",
"ng-recaptcha": "^9.0.0",
"ng2-file-upload": "^1.4.0",
"ngx-auth": "^5.4.0",
"ngx-bootstrap": "^6.1.0",
"ngx-facebook": "^3.0.0-0",
"ngx-img-cropper": "^11.0.0",
"ngx-infinite-scroll": "^10.0.1",
"ngx-moment": "^5.0.0",
"ngx-pagination": "^5.1.1",
"ngx-quill-editor": "^2.2.2",
"ngx-toastr": "^14.2.0",
"node-schedule": "^2.0.0",
"nodemailer": "^6.7.1",
"passport": "^0.5.0",
"passport-facebook-token": "^4.0.0",
"passport-google-id-token": "^0.4.7",
"passport-google-token": "^0.1.2",
"passport-linkedin-token": "^0.1.1",
"passport-local": "^1.0.0",
"pdf-to-text": "0.0.7",
"phantomjs-prebuilt": "^2.1.16",
"phone": "^3.1.10",
"phpass": "^0.1.1",
"rand-token": "^1.0.1",
"request": "^2.88.2",
"request-ip": "^2.1.3",
"rxjs": "^6.5.5",
"sharp": "^0.29.3",
"showdown": "^1.9.1",
"simple-line-icons": "^2.5.5",
"socket.io": "^4.3.2",
"socket.io-client": "^4.3.2",
"socket.io-redis": "^5.4.0",
"socketio-auth": "^0.1.1",
"textract": "^2.5.0",
"ts-loader": "9.2.6",
"underscore": "^1.13.1",
"unique-random-array": "^2.0.0",
"url": "^0.11.0",
"util": "^0.12.4",
"uuid": "^8.3.2",
"winston": "^3.3.3",
"xlsx": "^0.17.4",
"xss-clean": "^0.1.1",
"zone.js": "~0.11.4",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~13.0.3",
"#angular/cli": "^13.0.3",
"#types/express": "^4.17.13",
"#types/hammerjs": "^2.0.40",
"#types/mocha": "^9.0.0",
"#types/node": "^16.11.7",
"#types/underscore": "^1.11.3",
"husky": "^7.0.0",
"jasmine-core": "~3.10.1",
"jasmine-spec-reporter": "~7.0.0",
"jest": "^27.3.1",
"karma": "^6.3.9",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"lint-staged": "^12.0.2",
"mocha": "^9.1.3",
"ng-diff-match-patch": "^3.0.1",
"nodemon": "^2.0.15",
"protractor": "^7.0.0",
"supertest": "^6.1.6",
"tslib": "^2.3.1",
"tslint": "^6.1.3",
"typescript": "4.4.3",
"webpack": "^5.64.1",
"webpack-cli": "^4.9.1"
}
}
Any Idea
I just solve this issue by correcting the RxJS version to 7.4.0. I hope this can solve others issue as well.
My issues was resolved by adding it in the package.json
"overrides": {
"rxjs": "7.4.0"
},

React native project on android crashes as soon as you open the apk file

So I've been working on a React Native project, I'm on a Mac and when I run my apk file generated by the command ./gradlew assembleRelease and install it on my Google Pixel 4a I try to open the app and it instantly crashes and closes. However, when I run it in the emulator via command react-native run-android it works as expected. During the build, installation and even opening the app on my actual device it never gives a single error. Nothing has changed to my knowledge since the last time I ran the build command and it was working before so I'm lost and confused as to why this is happening. This also my first react-native project so maybe being a noob I'm missing something very obvious. Also iOS has absolutely no issues, any feedback or tips would be greatly appreciated. Thanks
My build.gradle file:
buildscript {
ext {
googlePlayServicesLocationVersion = "17.0.0" // Or higher.
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
appCompatVersion = "1.1.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
// Required for react-native-background-geolocation
url("${project(':react-native-background-geolocation').projectDir}/libs")
}
maven {
// Required for zoho chat widget
url("https://maven.zohodl.com/")
}
maven {
// Required for react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
package.json
{
"name": "NAME",
"version": "1.2.8",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"#homee/react-native-mapbox-navigation": "^1.0.5",
"#react-native-async-storage/async-storage": "^1.15.5",
"#react-native-community/checkbox": "^0.5.8",
"#react-native-firebase/app": "11.5.0",
"#react-native-firebase/auth": "11.5.0",
"#react-native-firebase/firestore": "^11.5.0",
"#react-native-picker/picker": "^1.9.12",
"#react-navigation/bottom-tabs": "^6.0.0-next.2",
"#react-navigation/drawer": "^6.0.0-next.2",
"#react-navigation/native": "^6.0.0-next.1",
"#react-navigation/stack": "^6.0.0-next.6",
"axios": "^0.21.1",
"expo-web-browser": "^9.0.0",
"firebase": "^7.24.0",
"firebase-tools": "^8.16.2",
"mobx": "^6.1.8",
"mobx-react-lite": "^3.2.0",
"mobx-state-tree": "^5.0.1",
"moment": "^2.29.1",
"mst-persist": "^0.1.3",
"react": "17.0.1",
"react-native": "0.64.0",
"react-native-background-fetch": "^4.0.1",
"react-native-background-geolocation": "^4.0.1",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown-picker": "^4.0.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-modalize": "^2.0.8",
"react-native-paper": "^4.7.2",
"react-native-portalize": "^1.0.7",
"react-native-reanimated": "^2.0.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.18.1",
"react-native-unimodules": "^0.12.0",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "^11.3.1",
"react-native-zohosalesiq-mobilisten": "^2.0.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.14.0",
"#react-native-community/eslint-config": "^2.0.0",
"#types/jest": "^26.0.20",
"#types/react": "^17.0.3",
"#types/react-native": "^0.63.51",
"#types/react-test-renderer": "^17.0.1",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"mobx-flipper": "^1.1.2",
"react-native-flipper": "^0.81.0",
"react-test-renderer": "17.0.1",
"typescript": "^4.2.3"
},
"jest": {
"preset": "react-native"
},
"prettier": {
"arrowParens": "always",
"printWidth": 100,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
}

Task :expo-permissions:compileReleaseKotlin FAILED

I want to create an apk . i am using expo bare project and i am using this command to create the apk for android
cd android && ./gradlew assembleRelease
and i am getting this error every time when i run the command .
here is the error
I have also tried to create the apk for a boilerplate app and that's working fine
but i am getting the error from this one i was using this command before
expo build:android
but by using this command by has a large size so i want to decrease its size that's why i am using
cd android && ./gradlew assembleRelease
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-permissions:compileReleaseKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
Package.json
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"#expo-google-fonts/montserrat": "^0.1.0",
"#expo-google-fonts/oswald": "^0.1.0",
"#expo-google-fonts/playfair-display": "^0.1.0",
"#react-native-community/cli-platform-ios": "^4.13.0",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/netinfo": "^5.9.2",
"#react-native-community/slider": "^3.0.0",
"#react-navigation/bottom-tabs": "^5.11.1",
"#react-navigation/drawer": "^5.9.0",
"#react-navigation/material-top-tabs": "^5.3.10",
"#react-navigation/native": "^5.6.1",
"#react-navigation/stack": "^5.6.2",
"#unimodules/core": "~6.0.0",
"base64-arraybuffer": "^0.2.0",
"expo": "~40.0.0",
"expo-av": "~8.7.0",
"expo-camera": "~9.1.0",
"expo-constants": "~9.3.3",
"expo-file-system": "~9.3.0",
"expo-image-picker": "~9.2.0",
"expo-linear-gradient": "^8.4.0",
"expo-localization": "~9.1.0",
"expo-location": "~10.0.0",
"expo-media-library": "~10.0.0",
"expo-splash-screen": "~0.8.0",
"expo-status-bar": "~1.0.3",
"expo-updates": "~0.4.0",
"i18n-js": "^3.8.0",
"import": "^0.0.6",
"localstorage-polyfill": "^1.0.1",
"moment": "^2.29.1",
"native-base": "^2.13.14",
"query-string": "^6.13.7",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-deck-swiper": "^2.0.5",
"react-native-dropdown-picker": "^3.7.6",
"react-native-easy-grid": "^0.2.2",
"react-native-gesture-handler": "~1.8.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-material-menu": "^1.2.0",
"react-native-paper": "^4.1.0",
"react-native-reanimated": "~1.13.0",
"react-native-responsive-fontsize": "^0.5.0",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "~3.1.9",
"react-native-screens": "~2.15.0",
"react-native-size-matters": "^0.3.1",
"react-native-step-indicator": "^1.0.3",
"react-native-svg": "^12.1.0",
"react-native-tab-view": "^2.15.2",
"react-native-unimodules": "~0.12.0",
"react-native-web": "~0.13.12",
"react-native-webview": "^11.0.0",
"react-navigation": "^4.4.0",
"socket.io-client": "^2.3.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.13.1"
},
"jest": {
"preset": "react-native"
},
"private": true
}
For bare workflow, you have to exclude expo-permissions module:
android/app/build.gradle:
Replace:
addUnimodulesDependencies()
with
addUnimodulesDependencies([exclude: ['expo-permissions']])
for iOS in Podfile:
Replace:
use_unimodules!
with
use_unimodules!(exclude: ['expo-permissions'])
The solution was posted here : https://github.com/expo/expo/issues/10283

Imports while testing with Jest fail

so I have React component that works well in the browser, but fails to render while testing. I am using Jest, and the component in question is a wrapper around React Sortable. While trying to launch the test, I get "_sortablejs2.default.create is not a function" error, which I have found out that is caused by imports (i.e. require('react')) in Sortable.js file returning 'undefined'. Why might that be? Other tests that I have work just fine.
Test itself:
let renderer = TestRenderer.create(
<DragAndDropSelector
selected={[]}
choices={[]}
selectedChange={ (a, b, c) => {return a} }
/>
);
expect(renderer.toJSON()).toMatchSnapshot();
});
My package json:
{
"name": "<Redacted/>",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "0.17.1",
"babel-eslint": "8.2.3",
"faker": "4.1.0",
"file-saver": "1.3.8",
"history": "4.7.2",
"html-to-react": "1.3.3",
"immutability-helper": "2.6.6",
"lodash": "4.17.5",
"moment": "2.21.0",
"npm": "6.1.0",
"npm-run-all": "4.1.2",
"react": "16.2.0",
"react-cookie": "2.1.4",
"react-datepicker": "1.4.1",
"react-dates": "16.6.1",
"react-dom": "16.2.0",
"react-redux": "5.0.7",
"react-redux-toastr": "^7.3.0",
"react-router": "4.2.0",
"react-router-dom": "4.2.2",
"react-scripts": "1.1.0",
"react-sortablejs": "^1.3.6",
"react-test-renderer": "16.2.0",
"redux": "3.7.2",
"redux-dehydrate": "0.0.2",
"redux-logger": "3.0.6",
"redux-persist": "5.6.5",
"redux-thunk": "2.2.0",
"semantic-ui": "2.3.1",
"semantic-ui-react": "0.78.2",
"sortablejs": "^1.7.0"
},
"scripts": {
"build-css": "less-watch-compiler --run-once src src",
"watch-css": "npm run build-css && less-watch-compiler src src",
"start-js": "PORT=3000 react-scripts start --host 0.0.0.0",
"start": "npm-run-all -p watch-css start-js",
"build-js": "react-scripts build",
"build": "npm-run-all build-css build-js",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"less-watch-compiler": "1.11.0",
"redux-mock-store": "1.5.1",
"serve": "6.5.3"
},
"homepage__doc": "See VERSION in config/config.js, version should be the same",
"homepage": "/2.1/"
}
Im stumped, so any help would be appreciated:)
EDIT: As per request, more detailed error message:
TypeError: _sortablejs2.default.create is not a function
at Sortable.componentDidMount (/home/path/node_modules/react-sortablejs/lib/Sortable.js:120:50)
at commitLifeCycles (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:4553:24)
at commitAllLifeCycles (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5729:9)
at Object.invokeGuardedCallback$1 (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1559:10)
at invokeGuardedCallback (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1506:29)
at commitRoot (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5833:9)
at performWorkOnRoot (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6800:42)
at performWork (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6750:7)
at requestWork (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6661:7)
at scheduleWorkImpl (/home/path/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6515:11)
More info:
In react-sortablejs/lib/Sortable.js file, in line
var _sortablejs = require('sortablejs');
require returns undefined. However, I have sortablejs installed, I can see it with my very own eyes in the node modules. I even checked that it does get entered when rendering in browser, but not when running tests. I am stumped, so any help would be greatly appreciated :)

Categories