Error: `getwd` : No such file or directory - getcwd? [duplicate] - ruby-on-rails

When running rails generate on a new Rails 4.2 project, I keep getting the error:
~/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.3.0/lib/spring/configuration.rb:37:in `pwd': No such file or directory - getcwd (Errno::ENOENT)
How can I fix this?

The error is caused by an existing Rails Spring process running in the background.
You can easily solve this by running ps ax | grep spring to find the process id and then kill it.
There's an issue on the Rails GitHub about this:
https://github.com/rails/spring/issues/247

This error may also occur if you are working in a directory which was deleted from some other terminal instance.

If the directory (or some sub directory Rails will work with) you are working was renamed or removed, you'll have to run
cd .
and then you can run rails generate [...].

On my machine the same problem was arising because spring server stopped responding.
1:- To restart the spring server type in terminal
$: spring restart
2:- Try running the generator again.

Related

Module build failed: Error: spawn bin/rails ENOENT

After adding the ERB loader and adding the .erb file extension to my application pack (with webpacker), I am getting the following error:
ERROR in ./app/webpack/packs/application.js.erb
Module build failed: Error: spawn bin/rails ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
# multi (webpack)-dev-server/client?http://localhost:3035 ./app/webpack/packs/application.js.erb
it is also happening with the sample hello_erb.js.erb pack.
Here is an example app that reproduces the problem: https://github.com/jonhue/test_app
You may be missing generated files
If you are missing the bin/rails executable maybe you have cloned from a repository that followed the steps on this issue
Your enviroment should be good to go if you have rails installed correctly and then run:
Rails < 5
$ bundle exec rake rails:update:bin
Rails >= 5
$ rails app:update:bin
You may have issues with webpack installation and/or configuration
If those files on bin\ exists, you may have ran into problems when installing and/or configuring webpack.
Try creating a project installing everything following the documentation, commiting it with a versioning system like GitHub, copy/paste your project configuration and git diff it, I bet you will find differences between them.
You are using Windows or some enviroment that is problematic
If that is the case there is already a discussion to fix it in an open issue in webpacker github. But you could try stuff like using webpacker directly from github to get latest fixes, downgrading to other versions to see if the result is different, or use webpack from source and change the file install.rake that makes you call ./bin/rails app:template... to just rails app:template....
The ERB runner configuration contains a setting that must be changed for it to work on Windows. Open config\webpack\loaders\erb.js and replace this line:
runner: "bin/rails runner"
with this line:
runner: "ruby bin\\rails runner

creating jhipster-spring boot project war file error

I have an jhipster-spring boot application which is running docker. I want to create war file. I found some commands here:
https://jhipster.github.io/production/
When I type ./mvnw -Pdev package .I am typing this command in intellij terminal. I am getting this error: http://paste.ubuntu.com/23082073/
I have no idea what is it because normally my app is running correcty. What I need for creating war? Should I connect database? There is no more info in above link.
Thanks
from the logs that you pasted, it looks an error from spring and hibernate. check if the connections to database are working, check if your database is setup correctly as in the logs found this
Wrong column type in FRAUD.PUBLIC.MODEL_WEIGHT for column weight. Found: double, expected: real
after that use the command ./mvnw -Pprod package to generate the WAR file.
Hope this helps.

Regarding Neoload 5.0.2

I'm getting an error msg "Load Generator Unavailable" pop up evry 2 iterations when I run the script via check virtual user.Closing and reopeing Neoload solves the issue.Could any of you please help me in resolving this issue?
This looks like it is a common issue with Neoload across versions, we have seen this across all of our windows installations where we run with localhost as a load generator or when we run with stand-alone generators. Most of the time a stop and restart of the load generators and load controllers will solve this issue. On more rare occasions a complete restart of the controller server needs to happen. This is issue is appearing in the latest version as of the date of my response.
I use to have this problem. I just needed to restart my load generator. All I did was ssh into my load generator that was acting up. Then ran sudo –u neoload /opt/neoload/bin/LoadGeneratorAgent stop then after that I would run sudo –u neoload /opt/neoload/bin/LoadGeneratorAgent start & Exit and restart neoload and I stopped having the problem. You will just replace the path with your own. This is for external load generators not local host generators.

generating WAR file for ruby on rails application

I am using Warbler to generate a WAR file for my ruby on rails application. I don't use anything special in my application, and i only run the "warble war" command.
In the WAR generation i am getting those 2 warnings
warning: skipping minitest
warning: skipping json
Upon the importing of the WAR in eclipse, the project can't be built and it says
Archive for required library: '/WebContent/WEB-INF/lib/gems-gems-warbler-1.4.1-spec-sample_war-some.jar'cannot be read or is not a valid ZIP file
I tried to follow some workarounds from https://github.com/jruby/warbler/issues/199 but without any clue. I am using Rails version 4.0.2 and warbler version 1.4.1 .I am new to deployment so i would be grateful if somebody can help me. Thanks
A better way to exclude the offending file : the warble config.
Generate the configuration with
warble config
Then uncomment the following line to fix it :
config.gem_excludes = [/^(test|spec)\//]
Let me warn you that this is a complete butcher job and I only used this because I was perplexed as to why I was also getting the same errors and Tomcat died when trying to deploy my jruby/rails application. Here's what I did:
$ ls -l /usr/local/opt/tomcat/libexec/webapps/workspace/WEB-INF/lib/*sample*
You will see some warbler sample jars there. gems-gems-warbler-1.4.1-spec-sample_war-some.jar has a size of 0. It's the problem, but I figure I don't really need any sample jars, thank you. So:
$ bundle show warbler
/PATH/.rvm/gems/jruby-1.7.10#rails4/gems/warbler-1.4.1
$ rm -rf /PATH/.rvm/gems/jruby-1.7.10#rails4/gems/warbler-1.4.1/spec/*sample*
$ bundle exec warble war
Deploy to Tomcat, and the context starts just fine. Less than ideal and probably there is a "correct" solution. This got me moving forward, tho.

"Can't initialize a new Rails application within the directory of another, please Type 'rails' for help."

I'm just starting out with rails and I'm practicing the basic ruby commands, one of which is the rails new myproject command.
My projects are under the Aptana workspace directory where I've used the command line and Aptana both to create projects there. After a few creations and rails s commands and deletions, I've started getting this error message when I try to generate a new rails project:
"Can't initialize a new Rails application within the directory of
another, please Type 'rails' for help."
This doesn't just happen when I create a new project (rails new myproject) under the Aptana workspace directory, but also when I use the command rails new . directly inside the workspace directory. Can someone explain to me what I need to do to flush rails so it knows I don't have a project there anymore? What did I do to make this happen?
I don't remember what rails looking for. The quickest way to solve this issue is to completely empty the affected directory.
Most likely there are some hidden files or directories which prevents rails from creating a new project. Look at that with ls -a probably there is a .bundle folder inside that dir.
I got same problem since I failed to create rails project. I tried to remove Aptana plug-in and Eclipe that include ./eclipse, ./metadata but not sloved the problem until I removed Ruby and Devkit and reinstall them again.
So, I think the root cause may in Devkit or Ruby. The problem work out after I reinstall Ruby(rubyinstaller-2.2.3-x64.exe) and DevKit(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe).
If you are under Windows, you must install Aptana Studio as administrator or it will not work properly. Uninstall and install it as administrator and the terminal folder will be set correctly

Resources