Problem migrating w/ sqlite3, receive error message-> undefined method `prerequisites' for nil:NilClass - sqlite

I'm working on the RoR3 Tutorial and i'm on chapter 6 when I tried the rakedb:migrate command. I received the message:
rake aborted!
undefined method `prerequisites' for nil:NilClass
I ignored the changes to the Gemfile because it already was installing sqlite3. When I changed it to 'sqlite3-ruby', '1.2.5' :required => 'sqlite3', i got an ActiveRecord::ConnectionNotEstablished message when trying to view the page locally. So, I just decided to not make that change.
I am using lion os, ruby 1.9.2p290, rails 3.1.0.rc8. Thx!

I'm working on the same tutorial at the moment, and ran into the same issue. After some digging, it turns out this is a bug with rspec-rails. If you look at rpsec-rails' change log for 2.6.1
guard against calling prerequisites on nil default rake task (Jack
Dempsey)
the book also doesn't get a chance to go into detail on what's going on when you run "bundle install", turns out bundler is meant to solve application dependencies: http://gembundler.com/rationale.html
Anyway, this was the solution: https://github.com/rails/rails/issues/1723
Change 'rspec-rails' under :development in your gemfile to:
gem 'rspec-rails', '2.6.1.beta1'
and 'rspec' under :test to
gem 'rspec', '2.6'
worked for me. Let me know if you want to work through the book together!

Related

Angular ERROR: PostCSS received undefined instead of CSS string

Trying to build an Angular project and I'm getting the errors below. This project built fine last week. I made some changes to other projects that use the Dlls from this project, but no changes to this project. I already spent a lot of time troubleshooting it with no luck and appreciate any help.
ERROR: PostCSS received undefined instead of CSS string
An unhandled exception occurred: PostCSS received undefined instead of CSS string
This can sometimes happen if node-sass was compiled for a different version of Node.js than you're currently running (ie if you've recently changed your Node.js version). You can fix that with:
npm rebuild node-sass
if you are using webpack, and trying to use sass-loader, also add sass
I had this same issue when attempting to test an Angular library, and the issue was I had [``] instead of [] in the styles property of my component metadata.
Wrong
#Component({
selector: 'my-input',
template: `
<input
... />
`,
styles: [``],
Right
#Component({
selector: 'my-input',
template: `
<input
... />
`,
styles: [],
I had similar problem. I was trying to build an angular library and the message below appeared:
Building Angular Package
------------------------------------------------------------------------------
Building entry point 'library-name'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
ERROR: PostCSS received undefined instead of CSS string
An unhandled exception occurred: PostCSS received undefined instead of CSS string
See "/tmp/ng-itlEgm/angular-errors.log" for further details.
[12:03:38] 'compile' errored after 17 s
[12:03:38] Error: Command `ng build library-name --prod` exited with code 127
at ChildProcess.handleSubShellExit (/node_modules/gulp-run/command.js:166:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:505:15)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
[12:03:38] 'build' errored after 17 s
I was using gulp-run to execute the command ng build library-name --prod. But, executing the command ng build library-name --prod directly on the terminal, the log error was smaller, but similar too.
The problem was in one component. The component had one styleURL (Angular component decorator), like this:
...component.css
but, the library uses scss. So, I changed the path to:
...component.scss
and I executed the command 'ng build library-name --prod'. So, the error didn't appear again.
I was using NVM v0.35.2 (allow to have more than one NodeJS version installed in my machine); NodeJS v12.18.2; Ubuntu x64 18.0.4 LTS and Angular CLI 9.1.9.
I faced the same situation now and the command that helped me is -
npm i node-sass -D
Check the node version, see if the version of node changes cause this problem. I use node version 16.14.2 which occured this error, after switch to 12.16.1 it works well. Just check your node-sass and node version will find a way out.
This can happen due to change in version of node. I had same issue with a NUXT app. What I did was
using yarn, in the root directory of your project, run yarn. But if you're using npm run npm install
start your project again.

Cannot read property 'context' of undefined with css-blocks and webpack

Here is my webpack config: https://hastebin.com/esipapepiz.js
I am trying to use https://github.com/linkedin/css-blocks
I am using create-react-app and I have ejected. I am trying to run the dev server and I get the message from my title. The docs seem pretty hard to follow so I am not sure what I am doing wrong?
yarn run v1.3.2
$ node scripts/start.js
Failed to compile.
Cannot read property 'context' of undefined
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Still little confused with your question because you didn't mention what the webpack version you used. I assumed that you used webpack version v4.0.0. context is working fine with earlier version of webpack.
webpack v4.0.0 changed this.context => this.rootContext
Do like this.it's a sample code snap
+ var name = slash(path.relative(root || this.rootContext || this.options.context, this.resourcePath));

class PHPUnit\Framework\ExpectationFailedException not found

when I try to run a failed test with this command :
./vendor/bin/phpunit
I get this Fatal Error :
PHPUnit 5.7.20 by Sebastian Bergmann and contributors.
PHP Fatal error: Class 'PHPUnit\Framework\ExpectationFailedException'
not found in /var/www/zend/vendor/zendframework/zend-
test/src/PHPUnit/Controller/AbstractControllerTestCase.php on line 444
Your version of phpunit is probably too old for your version of Zend. The class PHPUnit\Framework\ExpectationFailedException have been renamed in PhpUnit 6.X from PHPUnit_Framework_ExpectationFailedException to ExpectationFailedException
Please check your PhpUnit version: phpunit --version, it should be 6.X. Update it to the last version to avoid this error.
This is "fixed" by a script in Zend\Test called phpunit-class-aliases.php but it's not configured properly IMHO since it's in the autoload-dev section (meaning it doesn't propagate out to other projects.)
So, in your project composer.json, do something like this:
"autoload-dev": {
"files": [
"vendor/zendframework/zend-test/autoload/phpunit-class-aliases.php"
]
},
Then composer install
N.B. Zend\Test has a pull request that fixes this very thing, but they're saying it's PHPUnit's fault (Shame on you PHPUnit 4 for... idunno... having the wrong class name according to Zend\Test) So, I've done it instead: composer require illchuk/phpunit-class-aliases
This is a configuration flaw in zend-test. It consumes classes from Phpunit 6 but per it's Composer requirements, Phpunit before that version are OK to require:
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0",
Most likely as your system because of the PHP version does not satisfy the requirements of Phpunit 6, the next lower version was installed.
As the code in the base test case (https://github.com/zendframework/zend-test/blob/master/src/PHPUnit/Controller/AbstractControllerTestCase.php#L444) makes use of Phpunit 6 classes, I strongly assume that when the configuration flaw is made aware to the Zend-Test project, you won't be even able to install on your system any longer.
Therefore upgrade to a recent PHP version and then run
composer update
If you're stuk with the PHP version, downgrade zend-test to a version that supports an older Phpunit version. I don't know that project well, so it's just a suggestion, I don't know if such a version exists or can't even recommend one.
I filed a report, perhaps using that one class was an oversight or there is a less hard way to resolve the dependency: https://github.com/zendframework/zend-test/issues/50

Updating to Meteor 0.9.1 woes (broke the app big time)

I’ve had some serious problems after updating meteor to 0.9.1.
Here are some example errors from the console.
Uncaught TypeError: undefined is not a function -- in dynamic_template.js
Uncaught TypeError: Cannot read property ‘prototype’ of undefined -- in helpers.js
Uncaught TypeError: undefined is not a function -- in router.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in iron-router-progress.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in global-imports.js
And dozens of: Uncaught ReferenceError: Template is not defined -- in client view js files, both the hard copies that I have created and the apparently ephemeral files that meteor apparently creates on the fly.
And fewer dozens of: Uncaught ReferenceError: Meteor is not defined -- in the same kind of files.
And one: Uncaught ReferenceError: Spacebars is not defined -- in login_buttons_dialogs.html
And about 10 sockjs errors on GET — net:ERR_CONNECTION_REFUSED
I can’t help thinking that either something very basic was not accomplished during the update procedure or there are some very basic and widespread changes that need to be made in my code in order for it to run 0.9.1.
I’m building a app that is an extension and morph of the microscope app. It's not rocket science at this point. It was working last night before the update. It was 0.9.0.1 before the update.
All help and insight is appreciated.
Thanks for the guidance. All seems to be well now. This is what I did:
I created a new meteor app, removed 2 default packages, then added:
bootstrap
iron:router
mrt:accounts-ui-bootstrap-dropdown
accounts-password
mrt:iron-router-progress
sacha:spin
Then I copied my files from the broken app to the new app and viola', everything worked.
I see that the directory structure and its naming conventions have changed, colons in place of dashes in a few spaces and the direcory or namespace prefixes such as mrt, iron, and sacha.
Here's an unexpected thing. I previously had a folder called packages in which there was a folder for each package containing all its files. Now that folder is empty, but everything is still working. I'm clearly under informed about a few things.
Again, thanks for the guidance. Even though this was a pain, I see that the resulting changes needed to happen.
Best, Alex
Many packages are breaking on Meteor#0.9.1, I suggest you create a new Meteor app like so:
$ meteor create --release 0.9.0 app
$ cd app
$ meteor remove insecure
$ meteor remove autopublish
and then add all the packages you need with meteor add packagename and copy over all the files from your app.
Stick with Meteor#0.9.0 until you know you can safely upgrade!

SQL Syntax Error with Jruby under EngineYard

I am having some fun with Jruby, but I am having troubles getting my app deployed on EngineYard. Under deploy I am getting the follow error:
ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(2147483647) DEFAULT NULL' at line 1: ALTER TABLE `iterations` CHANGE `points` `points` longtext(2147483647) DEFAULT NULL
Even though my database.yml uses SQLITE and not MySQL. The migration file is listed as:
class ChangePointsToLongtext < ActiveRecord::Migration
def up
change_column :iterations, :points, :longtext
end
def down
change_column :iterations, :points, :text
end
end
I am almost certrain its the change_column - I have tried t.change and looked around for other syntax changes. I think it may be an issue with the Jruby version running on EngineYard - which I can't update.
My GemFile looks like this:
platforms :jruby do
gem 'jruby-openssl'
gem 'trinidad'
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcmysql-adapter'
gem 'jdbc-mysql', :require => false
gem 'jdbc-sqlite3', :require => false
end
So I believe I have all the relevant gems loaded in order to establish a database under Jruby, although I may be very wrong! I think I just need an alternative to change_column
Has anyone run into a similar problem? Or have any advice on changes? any help is always much appreciated!
Thanks
C
First, please use https://support.cloud.engineyard.com/ if you need help with Engine Yard.
Second, EY does not support SQLite. When your application is deployed to EY, EY will replace database.yml with appropriate information so that your application can use DB indicated in the environment configuration. The DB choice should default to MySQL when you set up your environment.
And finally, it appears that something is generating the incorrect SQL statement. Seeing that a similar migration works with MRI and mysql2 adapter, the issue probably lies with JDBC adapter. You can open an issue at https://github.com/jruby/activerecord-jdbc-adapter/issues or http://bugs.jruby.org.
Thanks.

Resources