When in localhost AdminBro bundle function is taking path, but when deployed to the Vercel production getting error, why? - express

In the local server, it is working correctly. Only when deployed to Vercel getting this error.
This is the following code - (The error is occurring in the AdminBro.bundle as it is not taking the argument.)
imagePath: {
isVisible: { list: false, filter: false, show: true, edit: true },
components: {
show: AdminBro.bundle(
"components/admin-imgPath-component.jsx"
),
},
},
The error I am getting.
2021-08-26T18:14:08.075Z undefined ERROR ConfigurationError:
Given file "components/admin-imgPath-component.jsx", doesn't exist.
More information can be found at: https://softwarebrothers.github.io/admin-bro-dev/AdminBro.html
at Function.bundle (/var/task/node_modules/admin-bro/lib/admin-bro.js:375:13)
at Object.<anonymous> (/var/task/routes/admin.js:47:30)
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)
at Object.<anonymous> (/var/task/app.js:25:21)
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 ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
RequestId: ce1bf09a-857f-4c40-8a3b-e8a1762590bb Error: Runtime exited with error: exit status 1
Runtime.ExitError

You have to call
show: AdminBro.bundle(
"components/admin-imgPath-component"
),
WITHOUT extension at the end.
Make sure that adminjs automatically generates an folder with file .adminjs/.entry.js where the Component gets linked to the AdminJS instance.

Related

Why npm can't find module '../../package.json' even if it already exists

The problem: when I start using npm commands I see the same error:
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module '../../package.json'
Require stack:
- C:\Users\Demian\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js
- C:\Users\Demian\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\Demian\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Demian\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Demian\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\utils\\unsupported.js',
'C:\\Users\\Demian\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
'C:\\Users\\Demian\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
]
}
The same problem with npm i, -v, init and etc. The same error is when I start it from C:/user or in a project with package.json where all works before. node works correctly. What should I do?

react native android error after upgrade to 0.67.2 - SyntaxError: Unexpected token =

I have just upgraded from RN 0.63.3 to 0.67.2...and Im now receiving an error when I try to clean project in Android studio
....node_modules\#react-native-community\cli-plugin-metro\node_modules\metro\src\Server.js:350 processRequest = (req, res, next) => { ^SyntaxError: Unexpected token = at Module._compile (internal/modules/cjs/loader.js:721:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (....node_modules\#react-native-community\cli-plugin-metro\node_modules\metro\src\shared\output\bundle.js:12:16) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
If you look at the file path its referring to (node_modules\#react-native-community\cli-plugin-metro\node_modules\metro\src\Server.js:350)...this is the line of code where its unhappy
processRequest = (req, res, next) => {
this._processRequest(req, res, next).catch(next);
};
Upgrading node to latest version fixed the issue

How to use ssr supported packages in vue with vue-server-renderer?

I tried to use vue2-google-maps and it worked well.
Suddenly my computer had stopped working and then I restarted my computer.
Then, strangely, 500-error comes out.
I reverted all codes associated with vue2-google-maps then my project works well.
Even though when I import vue2-google-maps then It occurs 500-error. :(
App.js
import * as VueGoogleMaps from 'vue2-google-maps';
It was working well but now cause of the unknown reason it has been broken...
Here is my console shows error.
webpack built 5410edae88d11b814c0b in 2690ms
error during render : /search
/media/bossminion/Work/WeMeet/frontend/node_modules/vue2-google-maps/dist/components/infoWindow.vue:3
<template>
^
SyntaxError: Unexpected token <
at Module._compile (internal/modules/cjs/loader.js:720:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/media/bossminion/Work/WeMeet/frontend/node_modules/vue2-google-maps/dist/main.js:42:19)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at r (/media/bossminion/Work/WeMeet/frontend/node_modules/vue-server-renderer/build.dev.js:9295:16)
at Object.<anonymous> (webpack:/external "vue2-google-maps":1:0)
at __webpack_require__ (webpack:/webpack/bootstrap a442baf8af813fadc2a4:25:0)
error during render : /favicon.ico
/media/bossminion/Work/WeMeet/frontend/node_modules/vue2-google-maps/dist/components/infoWindow.vue:3
<template>
^
SyntaxError: Unexpected token <
at Module._compile (internal/modules/cjs/loader.js:720:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/media/bossminion/Work/WeMeet/frontend/node_modules/vue2-google-maps/dist/main.js:42:19)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at r (/media/bossminion/Work/WeMeet/frontend/node_modules/vue-server-renderer/build.dev.js:9295:16)
at Object.<anonymous> (webpack:/external "vue2-google-maps":1:0)
at __webpack_require__ (webpack:/webpack/bootstrap a442baf8af813fadc2a4:25:0)
Is it possible that project that worked well could cause 500-error for no reason?
Environment: Ubuntu 18.04, npm v6.9.0, node v12.6.0
I have found how to handle ssr.
App.js
if (process.browser) {
const VueGoogleMaps = require('vue2-google-maps');
Vue.use(VueGoogleMaps, {
load: {
key: 'myKey',
libraries: 'places',
},
});
}
Instead of using import, I used require when it is client rendering.
I will be happy if it helped you. :D

How can I retry failed end to end tests in Detox using Mocha?

I have a flaky end-to-end test that uses Detox and Mocha.
The Mocha test runner allows for multiple retries. I tried using the recommended Mocha syntax:
// auth.spec.js
describe('App authentication', () => {
this.retries(2);
it('should have a login screen', async () => {
await expect(element(by.id('LoginScreenView'))).toBeVisible();
});
});
However, it appears this is an empty object ({}) and does not have a retries function when running Detox with Mocha as the test runner.
It generates the following error:
node_modules/.bin/mocha __e2e__ --opts __e2e__/config/mocha.opts --
configuration ios.sim.debug --grep :android: --invert --artifacts-location "__e2e__/artifacts/ios.sim.debug.2018-10-17 22-51-12Z"
/<path>/__e2e__/auth.spec.js:10
this.retries(2);
^
TypeError: this.retries is not a function
at Suite.describe (/<path>/__e2e__/auth.spec.js:4:8)
at Object.create (/<path>/node_modules/mocha/lib/interfaces/common.js:112:19)
at context.describe.context.context (/<path>/node_modules/mocha/lib/interfaces/bdd.js:40:27)
at Object.<anonymous> (/<path>/__e2e__/auth.spec.js:3:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at /<path>/node_modules/mocha/lib/mocha.js:250:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/<path>/node_modules/mocha/lib/mocha.js:247:14)
at Mocha.run (/<path>/node_modules/mocha/lib/mocha.js:576:10)
at Object.<anonymous> (/<path>/node_modules/mocha/bin/_mocha:637:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
child_process.js:644
throw err;
^
Is there a way to automatically retry failed tests in Detox?
this in mocha can't work with arrow function, so must change it into ordinary one
// auth.spec.js
describe('App authentication', function () { // change it
this.retries(2);
It is not recommended best practice to use in Mocha
Ref:
https://mochajs.org/#arrow-functions
Hope it helps

Cannot find module 'less' though less is present

I know this question had been asked a few times already, but I tried everything I found and nothing worked, so I'll ask directly
I have a symfony 2.0 project, in which I'm building a docker
But when I try to run assetic:dump, I get this error :
[RuntimeException]
module.js:340
throw err;
^
Error: Cannot find module 'less'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/tmp/assetic_lessJknvfV:1:74)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
But less is already installed, when I type which less :
/usr/bin/less
When I type /usr/bin/less it works
My parameters.ini less part :
less.node = /usr/bin/nodejs
less.node_path = /usr/bin/less
My assetic config in config.yml :
assetic:
debug: %kernel.debug%
use_controller: false
filters:
cssrewrite: ~
less:
node: %less.node%
node_paths: [%less.node_path%]
apply_to: "\.less$"
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
yui_js:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
I'm working with php 5.6
Thanks for your time and help :)