NoMethodError in ActiveAdmin::Devise::Sessions#new - activeadmin

I have looked through numerous articles now where a number of them touch on this but none seem to resolve the issue I'm having. I have installed ActiveAdmin and everything was working fine until I tried pushing to heroku. Now I'm getting the below error and not sure how to resolve.
NoMethodError in ActiveAdmin::Devise::Sessions#new
Showing /Users/gregoryhooven/.rvm/gems/ruby-1.9.3-p448/bundler/gems/active_admin-6c9e22ab0922/app/views/active_admin/devise/sessions/new.html.erb where line #7 raised:
undefined method `[]' for nil:NilClass
xtracted source (around line #7):
<% scope = Devise::Mapping.find_scope!(resource_name) %>
<%= active_admin_form_for(resource, :as => resource_name, :url => send(:"# {scope}_session_path"), :html => { :id => "session_new" }) do |f|
f.inputs do
**resource.class.authentication_keys.each { |key| f.input key, :input_html => {:autofocus => true}}**
f.input :password
f.input :remember_me, :label => t('active_admin.devise.login.remember_me'), :as => :boolean if devise_mapping.rememberable?
end

A bit late but maybe to use for others.
I kind of had the same issue on my local system. I wanted to reinstall activeadmin. After reinstall webrick gave me this error code if is tried 127.0.0.1:3000/admin/login
ActionView::Template::Error (undefined method `new_password_path' for#<#<Class:0x007fc7ef1a3d08>:0x007fc7ef1a2f70>):
and also the rendered view looked not very nicely. I figured out i had to some gem dependencies not met. Via bundle install i updated sass -from 3.4.16 to 3.4.14 - and arel- from 6.0.0 to 6.0.2. Then it worked nicely. Strange is that before i reinstalled activeadmin rails g active_admin:install i updated all gems. And as far as i understand activeadmin installs its needed packages and i did not touch my Gemfile for a while.

Related

vite - module is not defined error in 3rd party npm package

Here's the error I'm getting inside of my application:
Uncaught ReferenceError: module is not defined
at isHotReloading2 (isHotReloading.js:2:20)
at Form3.UNSAFE_componentWillMount (createReduxForm.js:511:16)
and here's what the error looks like in the chrome inspector:
I can't easily change the course code of redux-form (which is no longer being maintained) and neither can I remove it from my application. Is there a way to work around this error?
I've tried the following fixes in the vite.config.js file to no avail. Any ideas would be greatly appreciated. Thanks!
I ran into this same issue with Redux-form and fixed it as follows.
Create a file with the following
const isHotReloading = () => false;
export default isHotReloading;
In your vite.config file add the following to resolve.alias
{
find: './util/isHotReloading',
replacement: path.resolve(__dirname, './PATH_TO_FILE_ABOVE/reduxFormHotReload.js'),
},
This will disable the hot reload update functionality all together, so maybe you could improve the function above, but I didn't worry about it.

Error: Cannot find module 'swiper/react' in next.js

After upgrading Swiper to Version 7.0.7, I'm getting this annoying error:
Error: Cannot find module 'swiper/react'
.
.
.
Source
.next\server\pages\items.js (1:0) # Object.swiper/react
> 1 | module.exports = require("swiper/react");
In the previous Version (6.8) I didn't see this error. I also checked the migration guide and github issues but found no helpful answer.
The thing is "import cost" extension in VSCode is showing the size of the imported module, so I think there's a problem with Next.js or webpack exporting it, but have no idea how to make it work.
I copy/pasted the exact code from Swiper docs, but will write it here too if it helps:
/* _app.js - imported here because Next doesn't allow global css imports elsewhere */
import 'swiper/scss';
/* slider component which is used inside pages/items.js */
import { Swiper, SwiperSlide } from "swiper/react"; /* 72.4k (gzipped 21.4k) */
export default function CategoriesBar() {
return (
<Swiper
spaceBetween={50}
slidesPerView={3}
onSlideChange={() => console.log('slide change')}
onSwiper={(swiper) => console.log(swiper)}
>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
<SwiperSlide>Slide 4</SwiperSlide>
</Swiper>
);
}
Update
after upgrading Next.js to 11.1.2, the error message changed to:
Error: Not supported
I found the solution. It was not related to next.js nor webpack. ESM modules support started from Node.js 12.20 and mine was 12.16. Upgraded my Node.js installation & everything is working fine now!
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

node.js | BAD_REQUEST error suddenly appeared

I use node.js with the google-translate-api package.
It all worked fine for months but suddenly and I can't tell why, the simple code
translate("hello", {from: "en", to: "fr"}).then(res => {
console.log(res.text);
}).catch(err => console.log(err));
stopped working and I get this error everytime now :
Error at C:\Users\...\AutoTranslate\node_modules\google-translate-api\index.js:105:17 at at process._tickCallback (internal/process/next_tick.js:188:7) code: 'BAD_REQUEST'
Therefore it is not due to my code but probably to some parameters of node but I don't know. From now on, other packages which use async calls crash with the same error.
I even tried to uninstall node and reinstall it but I can't make it to work again.
Thanks!
Your Ip has been blocked so try to connect with other network it will work fine

Expect assertions type error -> expect(...).toExist is not a function

I'm testing a NodeJS app. I encountered this error when I ran the tests. The test script is below:
.expect((res) => {
expect(res.headers['x-auth']).toExist();
expect(res.body._id).toExist();
expect(res.body.email).toBe(email);
})
The error showed:
TypeError: expect(...).toExist is not a function
How can I resolve this issue?
The expect assertion library has changed ownership. It was handed over to the Jest team, who in their infinite wisdom, created a new API.
You must now use toBeTruthy()instead of toExist().
You can still install expect as before, npm install expect --save-dev, which is currently at version 21.2.1. Most methods names will remain unchanged except for a few, including toExist().
If you are using Jest you can also use 'toBeDefined()'

'Cannot find module' error using karma-browserify on Windows

I'm attempting to set up unit testing on an Angular/Browserify project using Karma, Karma-Jasmine, and Karma-Browserify. I'm on a Windows machine, for reference. karma-cli is on my global npm path, and karma, karma-jasmine, karma-browserify, and browserify are all local npm installs, using -D.
I'm trying to pull in a single spec file, which looks like:
var PhoneListCtrl = require('../../../public/js/app/controllers/phone-list');
describe('PhoneListCtrl', function() {
var scope,
ctrl;
beforeEach(function() {
scope = {};
ctrl = new PhoneListCtrl(scope);
});
it('should create "phones" model with 3 phones', function() {
expect(scope).not.toBe(undefined);
});
});
And I get the following error every time:
Uncaught Error: Cannot find module 'Cc/gGH'
I get this exact same error after cloning the following repos, installing karma and all plugins, and attempting to run their example test suites:
https://github.com/xdissent/karma-browserify
https://github.com/waye929/angular-browserify
What on earth am I doing wrong? The test spec module is found correctly, and karma seems to be finding all necessary plugins/preprocessors, but it appears that karma-browserify is tripping on the require statement in a spec every time, for reasons I cannot fathom.
I've uninstalled and reinstalled karma and all related plugins numerous times now, to no avail.
I managed to find a solution. The issue was caused by karma-browserify's own module name hashing function, which is incompatible with newer versions of browserify. There's a fork that deals with it by using browserify's hashing function:
https://github.com/voidlock/karma-browserify/commit/3afe3b7485f2e4723bba5ad1c5a730d560b8c234
There's a pull request pending but in the meantime you can use the fork by placing
"karma-browserify": "https://github.com/voidlock/karma-browserify/tarball/use-browserify-hash-function"
in your package.json (dev)dependencies section.

Resources