SailsJS Failed to reload ORM hook - javascript

After installing the sails-auth and sails-permissions package my autoreload hook (https://github.com/sgress454/sails-hook-autoreload) doesn't work anymore:
error: Failed to reload ORM hook. Details: Error: Failed to reinitialize ORM because the initialize() method of the ORM hook returned an error.
Details:
Error: Consistency violation: Instantiated Waterline model already has a datastore property.
Packages:
"bcryptjs": "^2.3.0",
"ejs": "2.3.4",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"marlinspike": "^1.0.0",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"rc": "1.0.1",
"sails": "~0.12.3",
"sails-auth": "^2.1.3",
"sails-disk": "~0.10.9",
"sails-hook-autoreload": "^0.13.1",
"sails-permissions": "^2.2.0",
"validator": "^5.2.0"
Sails version v0.12.3.
Any ideas how to fix this?

Related

JavaScript Error - RangeError: Maximum call stack size exceeded

I recently integrated "babel-plugin-istanbul": "^6.1.1" in my application and created babel.config.js file. Before I was using
"presets": [
"env"
]
},
in my package.json and then moved it to babel.config file.
The grunt version that I was using is "grunt-babel": "^6.0.0".
With this grunt-babel version, I get this error
Warning: Task "ngAnnotate" failed. Use --force to continue.
Aborted due to warnings.
When I change grunt-babel version to 8.0.0, the above error goes away but I see this error in my application console:
RangeError: Maximum call stack size exceeded
Babel.config:
const presets = ['env'];
const plugins = [];
if (process.env.ISTANBUL === 'true') {
plugins.push([
'istanbul',
{
include: ['src/**'],
exclude: ['dist/']
}
]);
}
module.exports = {
presets,
plugins
};
package.json file:
"babel-preset-env": "^1.7.0",
"githook-scripts": "^1.1.0",
"grunt": "^1.5.3",
"grunt-angular-templates": "^1.2.0",
"grunt-autoprefixer": "^3.0.4",
"grunt-babel": "^8.0.0",
"grunt-cli": "^1.2.0",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^3.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-htmlmin": "^3.1.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-less": "^3.0.0",
"grunt-contrib-uglify": "^5.2.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-filerev": "^2.1.2",
"grunt-karma": "^4.0.2",
"grunt-newer": "^1.1.0",
"grunt-postcss": "^0.9.0",
"grunt-svgmin": "^6.0.1",
"grunt-usemin": "^3.0.0",
"babel-plugin-istanbul": "^6.1.1",
"grunt-ng-annotate": "^4.0.0"
Can someone please help?

A dynamic import() which is available in all CommonJS modules

I got the below error when I'm trying to run npm install. Error Message:
taskRepository: Failed to require task module for setTimestamp: require() of ES Module ......\node_modules\dateformat\lib\dateformat.js from .....\setTimestamp.js not
supported.
Instead change the require of dateformat.js in .....\setTimestamp.js to a dynamic import() which is available in all CommonJS modules.
In setTimestamp.js file, we have
const stringReplacer = require("#ui5/builder").processors.stringReplacer;
const df = require("dateformat");
This is a SAPUI5 based cloud application and we've 2 package.json files.
Under Root folder:
"version": "1.2.0",
"devDependencies": {
"#ui5/builder": "^2.11.5",
"#ui5/cli": "^2.14.10",
"#wdio/cli": "7.23.0",
"#wdio/cucumber-framework": "7.23.0",
"#wdio/junit-reporter": "7.23.0",
"#wdio/local-runner": "7.23.0",
"#wdio/selenium-standalone-service": "7.23.0",
"#wdio/spec-reporter": "7.23.0",
"chai": "^4.3.6",
"chromedriver": "^104.0.0",
"cucumber-html-reporter": "5.5.0",
"nyc": "^15.1.0",
"opa-e2e": "^1.0.11",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"shelljs": "^0.8.5",
"type": "module",
"wdio-chromedriver-service": "^7.3.2",
"wdio-cucumber-reporter": "0.0.2",
"wdio-cucumberjs-json-reporter": "^4.4.3"
},
"resolutions": {
"terser": ">=5.14.2",
"markdown-it": ">=12.3.2",
"marked": ">=4.0.10",
"shelljs": ">=0.8.5",
"ejs": ">=3.1.7",
"node-fetch": ">=2.6.7",
"got": ">=11.8.5",
"follow-redirects": ">=1.14.8",
"minimist": ">=1.2.6"
}
Inner one:
"ui5": {
"dependencies": [
"ui5-middleware-livereload",
"ui5-middleware-simpleproxy",
"ui5-middleware-servestatic",
"#dwc/ui5-middleware-dwc"
]
},
"devDependencies": {
"#dwc/ui5-middleware-dwc": "^1.4.2-20220817085704",
"#ui5/cli": "^2.14.10",
"dateformat": "^5.0.3",
"env-cmd": "^10.1.0",
"eslint": "^8.22.0",
"karma": "6.4.0",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "^2.2.0",
"karma-junit-reporter": "^2.0.1",
"karma-qunit": "^4.1.2",
"karma-sinon": "^1.0.5",
"karma-ui5": "2.4.0",
"nyc": "^15.1.0",
"qunitjs": "^2.4.1",
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
"start-server-and-test": "^1.14.0",
"ui5-middleware-livereload": "^0.7.0",
"ui5-middleware-servestatic": "^0.4.0",
"ui5-middleware-simpleproxy": "^0.9.1",
"wdio-chromedriver-service": "7.3.2"
},
"resolutions": {
"terser": ">=5.14.2",
"markdown-it": ">=12.3.2",
"marked": ">=4.0.10",
"ua-parser-js": ">=0.7.24",
"log4js": ">=6.4.0",
"karma": ">=6.3.16",
"follow-redirects": ">=1.14.8",
"minimist": ">=1.2.6"
}
I tried to fix this issue by using:
npm i node-fetch#2.6.1
Or, in package.json file , wrote "type": "module" etc.
Ref: Instead change the require of index.js, to a dynamic import() which is available in all CommonJS modules
Could anyone please help me to solve the error? Any help would be much appreciate.
Request: Please don't close the question. I know it's duplicate question, however I couldn't find any solution, tried how much I found.Thank you
I got the same error requiring node-fetch. The solution was
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));

Dependencies were not found despite existing in package.json

EDIT: This question is related to #56558281 however it's two years old and hasn't been answered
I'm refactoring a few apps we have and tried moving a block of JS code from one NestJs app into another Nuxt app. After installing the dependencies I get this error:
These dependencies were not found: friendly-errors 11:04:41
friendly-errors 11:04:41
* child_process in ./node_modules/google-auth-library/build/src/auth/googleauth.js friendly-errors 11:04:41
* fs in ./node_modules/google-auth-library/build/src/auth/googleauth.js, ./node_modules/google-p12-pem/build/src/index.js and 4 others
friendly-errors 11:04:41
To install them, you can run: npm install --save child_process fs
I tried running npm install --save child_process fs without luck
Tried deleting node modules and clearing the cache then reinstalling with no luck
and I tried adding this block as per this answer without luck either
"browser":{
"child_process": false
}
Package.json
...
"dependencies": {
"#nuxt/types": "^2.14.5",
"#nuxtjs/apollo": "^4.0.1-rc.5",
"#nuxtjs/axios": "^5.12.5",
"#nuxtjs/gtm": "^2.2.2",
"#nuxtjs/vuetify": "^1.11.0",
"apollo-link-http": "^1.5.17",
"child_process": "^1.0.2",
"filestack-js": "^3.16.0",
"googleapis": "^39.2.0",
"google-auth-library": "^3.1.2",
"graphql": "^15.5.1",
"graphql-tag": "^2.12.5",
"isomorphic-fetch": "^3.0.0",
"net": "^1.0.2",
"nuxt": "^2.0.0",
"nuxt-i18n": "^6.12.2",
"nuxt-webfontloader": "^1.1.0",
"pluralize": "^8.0.0",
"readline": "^1.3.0",
"tls": "^0.0.1",
"typescript": "^3.0.0",
"url-slug": "^2.2.0",
"vue": "^2.6.11",
"vue-apollo": "^3.0.7",
"vue-infinite-loading": "^2.4.5",
"vuedraggable": "^2.24.3"
},
"devDependencies": {
"#mdi/font": "^5.3.45",
"#nuxt/typescript-build": "^2.0.3",
"#nuxtjs/eslint-config-typescript": "^3.0.0",
"#nuxtjs/eslint-module": "^2.0.0",
"#types/pluralize": "0.0.29",
"#vue/test-utils": "^1.0.0-beta.27",
"babel-eslint": "^10.0.1",
"babel-jest": "^26.0.1",
"deepmerge": "^4.2.2",
"eslint": "^7.9.0",
"eslint-plugin-nuxt": ">=0.4.2",
"eslint-plugin-prettier": "^3.0.1",
"fibers": "^5.0.0",
"jest": "^26.0.1",
"pug": "^2.0.3",
"pug-plain-loader": "^1.0.0",
"sass": "^1.26.11",
"sass-loader": "^8.0.2",
"typed-graphqlify": "^2.2.3",
"vue-class-component": "^7.1.0",
"vue-jest": "^4.0.0-beta.3",
"vue-property-decorator": "^9.0.0"
},
"browser":{
"child_process": false
}

IONIC 4: Problem with plugin firebase & google-maps - Default FirebaseApp is not initialized in this process com.superagent.agent. Make sure to call

I am using Ionic 4 to develop android apps, now I have a problem when using #ionic-native/google-maps & #ionic-native/firebase-messaging. I cant receive push notif & triggering firebase analytics. but my google maps is normally working. also, I'm using Jscrambler for these apps
I always got this error, when calling fcm.getToken() method, which is fcm is the alias of firebase-messaging plugin. this is the error :
ERROR Error: Uncaught (in promise): Default FirebaseApp is not initialized in this process com.xxx.xxx. Make sure to call FirebaseApp.initializeApp(Context) first.
at resolvePromise (/polyfills-es2015.js:4153)
at /polyfills-es2015.js:4063
at Object.callbackFromNative (cordova.js:297)
at processMessage (cordova.js:1134)
at processMessages (cordova.js:1157)
at ZoneDelegate.invoke (/polyfills-es2015.js:3715)
at Object.onInvoke (/vendor-es2015.js:82899)
at ZoneDelegate.invoke (/polyfills-es2015.js:3714)
at Zone.run (/polyfills-es2015.js:3480)
at /polyfills-es2015.js:4211
and function to call firebase getToken on app.component.ts is here:
async initializeApp() {
await this.platform.ready().then(() => {
this.params.getUserData().then(userdata => {
this.userData = userdata;
// set fcm token when there is saved session on storage for all environment
this.fcm.getToken().then(this.setDeviceId);
this.fcm.onTokenRefresh().subscribe(this.setDeviceId);
if(environment.production) {
// init fbase analytics only on production & there is saved session on storage
this.initFbAnalytics();
}else{
// subscribe to topic guest_dev when in develeopment mode
this.fcm.subscribe("guest_dev");
}
});
});
};
also my package.json file dependencies:
"dependencies": {
"#angular/animations": "^8.2.0",
"#angular/common": "^8.2.0",
"#angular/core": "^8.2.0",
"#angular/forms": "^8.2.0",
"#angular/platform-browser": "^8.2.0",
"#angular/platform-browser-dynamic": "^8.2.0",
"#angular/router": "^8.2.0",
"#ionic-native/app-rate": "^5.33.1",
"#ionic-native/camera": "^5.11.0",
"#ionic-native/clipboard": "^5.27.0",
"#ionic-native/core": "^5.11.0",
"#ionic-native/facebook": "^5.28.0",
"#ionic-native/file": "^5.27.0",
"#ionic-native/file-opener": "^5.27.0",
"#ionic-native/firebase-analytics": "^5.11.0",
"#ionic-native/firebase-messaging": "^5.11.0",
"#ionic-native/google-maps": "^5.5.0",
"#ionic-native/in-app-browser": "^5.12.0",
"#ionic-native/keyboard": "^5.29.0",
"#ionic-native/market": "^5.26.0",
"#ionic-native/mobile-accessibility": "^5.30.0",
"#ionic-native/social-sharing": "^5.11.0",
"#ionic-native/splash-screen": "^5.11.0",
"#ionic-native/sqlite": "^5.29.0",
"#ionic-native/status-bar": "^5.11.0",
"#ionic/angular": "^4.7.1",
"#types/hammerjs": "^2.0.36",
"compare-func": "^2.0.0",
"cordova-android": "9.0.0",
"cordova-browser": "6.0.0",
"cordova-clipboard": "^1.3.0",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-appsflyer-sdk": "^4.4.22",
"cordova-plugin-camera": "4.1.0",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-facebook4": "^6.4.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-opener2": "^3.0.4",
"cordova-plugin-firebase-analytics": "^3.0.0",
"cordova-plugin-firebase-messaging": "^3.0.0",
"cordova-plugin-inappbrowser": "^3.1.0",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^3.0.0",
"cordova-plugin-market": "^1.2.0",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-whitelist": "1.3.3",
"cordova-plugin-x-socialsharing": "^5.4.7",
"cordova-sqlite-storage": "^5.1.0",
"cordova-support-android-plugin": "^1.0.1",
"cordova-support-google-services": "^1.3.1",
"core-js": "^2.6.9",
"crypto-js": "^4.0.0",
"dom-to-image-more": "^2.8.0",
"es6-promise-plugin": "^4.2.2",
"hammerjs": "^2.0.8",
"ion-bottom-drawer": "^2.0.0",
"ion2-calendar": "^3.0.0-rc.0",
"ionic-long-press": "2.0.3",
"jscrambler": "^5.5.25",
"jspdf": "^1.5.3",
"moment": "^2.27.0",
"rxjs": "~6.5.2",
"text-mask-core": "^5.1.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
}
oh and here is my ionic info
Ionic:
Ionic CLI : 6.14.0 (/usr/local/lib/node_modules/#ionic/cli)
Ionic Framework : #ionic/angular 4.11.13
#angular-devkit/build-angular : 0.803.29
#angular-devkit/schematics : 8.3.29
#angular/cli : 8.2.2
#ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run (update available: 1.4.0) : 1.3.0
System:
Android SDK Tools : 26.1.1 (/home/nt/Android/Sdk)
NodeJS : v10.19.0 (/usr/bin/node)
npm : 6.14.4
OS : Linux 5.8

Webpack Error: please install sqlite3 package manually

I'm building an application with Electron and Sequelize. I started to configure my database, then, I've received this error:
Uncaught Error: Please install sqlite3 package manually
at new ConnectionManager (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/con…:31)
at new SqliteDialect (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/dialects/sqlite/ind…:14)
at new Sequelize (/home/matheusdrdj/Documentos/Git/personal-
management/node_modules/sequelize/lib/sequelize.js:239)
at eval (index.js?17a5:3)
at Object. (renderer.js:1084)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (index.js?21f1:1)
at Object. (renderer.js:1077)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at eval (main.js?3b76:1)
at Object. (renderer.js:918)
at webpack_require (renderer.js:680)
at fn (renderer.js:90)
at Object. (renderer.js:835)
at webpack_require (renderer.js:680)
at renderer.js:726
at renderer.js:729
I have installed sqlite3 globally and localy, tested it on the console and it's working fine. But, my application doesn't even load the screen.
My dependencies:
"dependencies": {
"axios": "^0.16.1",
"sequelize": "^4.37.7",
"sqlite3": "^4.0.0",
"vue": "^2.4.2",
"vue-electron": "^1.0.6",
"vue-router": "^2.5.3",
"vuetify": "1.0.0",
"vuex": "^2.3.1"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "0.1.2",
"cfonts": "^1.1.3",
"chalk": "^2.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^1.7.5",
"electron-builder": "^19.19.1",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.7.3",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"js-sha256": "^0.9.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"style-loader": "^0.18.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"url-loader": "^0.5.9",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2"
}
I cannot figure out what is happening.
With Electron sqlite3 has to be built with electron-builder.
How to use sqlite3 module with electron?
and https://github.com/electron-userland/electron-builder
both recommend adding this to your package.json
"postinstall": "electron-builder install-app-deps"
This will rebuild all native binaries everytime you install a new package.

Categories