I am getting the following error even if I have jquery-ui in my application.js file
即使我的应用程序中有jquery-ui,也会出现以下错误。js文件
couldn't find file 'jquery-ui' (in /home/jeff/work/projects/a/media/app/assets/javascripts/application.js:14)
无法找到“jquery-ui”文件(在/home/ jeff/work/projects/a/media/appa/assets/javas/ jsp .js:14)
application.js
application.js
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery.validate.min
Can anybody help me?
有人能帮助我吗?
6 个解决方案
#1
114
Use specific version of gem "jquery-rails", "~> 2.3.0"
as later version of gem has deleted the ui part.
使用特定版本的gem“jquery-rails”、“~> 2.3.0”,因为后来的gem版本已经删除了ui部分。
or
或
you can use gem "jquery-ui-rails"
for jquery-ui
. For more information please visit the git repository
您可以对jquery-ui使用gem“jquery-ui-rails”。有关更多信息,请访问git存储库。
To require all jQuery UI modules, add the following to your application.js:
要要求所有jQuery UI模块,请向application.js中添加以下内容:
for version 5.0 and more it has been changed. Please follow the link
对于5.0或更多版本,它已经被修改。请按照这个链接
application.js:
application.js:
//= require jquery-ui
application.css:
application.css:
/*
*= require jquery-ui
*/
For lesser version than 5.0 we need to write below format
对于小于5.0的版本,我们需要写在格式下面
application.js:
application.js:
//= require jquery.ui.all
Also add the jQuery UI CSS to your application.css:
还可以将jQuery UI CSS添加到应用程序中。
application.css:
application.css:
/*
*= require jquery.ui.all
*/
Hope this could help you
希望这对你有帮助。
#2
34
I think you are using new version (your version > 2.3.0) of jquery-rails.
我认为您正在使用jquery-rails的新版本(您的版本> 2.3.0)。
jQuery UI has been removed from jquery-rails gem,
jQuery UI已从jQuery -rails gem中删除,
-
≤ jquery-rails v2.3.0
still have jQuery UI - 如果≤jquery-rails 2.3.0还有jQuery UI
-
≥ jquery-rails v3.0.0
jQuery UI removed - ≥jquery-rails v3.0.0 jQuery UI移除
Take a look this commit.
看看这个承诺。
If you are using ≥ jquery-rails v3.0.0
or latest version of jquery-rails
如果您使用的是≥jquery-rails v3.0.0或jquery-rails的最新版本
You should use jquery-ui-rails
gem for using jquery UI in rails, https://github.com/joliss/jquery-ui-rails.
您应该使用jquery- UI -rails gem在rails中使用jquery UI, https://github.com/joliss/jquery-ui-rails。
In your Gemfile, add:
在你Gemfile,添加:
gem 'jquery-ui-rails'
宝石的jquery-ui-rails
and run bundle install
和运行包安装
-
v2.3.0 < your version ≤ v4.2.1
v2.3.0 <版本≤v4.2.1< p>
And put this into
application.js
把这个放到application。js中
//= require jquery.ui.all
then put this into
application.css
然后放到application.css中
*= require jquery.ui.all
-
≥ jquery-ui-rails v5.0.0 or latest version
≥jquery-ui-rails v5.0.0或最新版本
And put this into
application.js
把这个放到application。js中
//= require jquery-ui
then put this into
application.css
然后放到application.css中
*= require jquery-ui
or to use specific modules read this
或者使用特定的模块阅读
Don't forget restart your server.
不要忘记重新启动服务器。
If you are using ≤ jquery-rails v2.3.0
如果您使用的是≤如果jquery-rails 2.3.0
see my answer here https://*.com/a/16996710/1297435 for use gem 'jquery-rails', "~> 2.3.0"
查看我的答案,https://*.com/a/16996710/1297435,使用gem ' jqueryrails ', "~> 2.3.0"
#3
9
The rails 4 answer:
rails 4答:
add to gemfile.rb:
添加gemfile.rb:
gem 'jquery-ui-rails'
add to application.js:
添加application.js:
//= require jquery
//= require jquery-ui
//= require jquery_ujs
to add a specific module:
添加特定模块:
//= require jquery
//= require jquery-ui/yourmodulename
//= require jquery_ujs
I'm not sure if restarting your server is explicitly required but it never hurts anything.
我不确定是否需要重新启动服务器,但是这样做不会有任何影响。
#4
4
I know its a noob mistake but I found this very frustrating and always forget to restart my app after I have installed something new.
我知道这是一个错误,但我发现这是非常令人沮丧的,我总是忘记重启我的应用后,我已经安装了一些新的东西。
Make sure to restart your rails server after you have followed the instructions above and it should work perfectly.
在遵循了上面的说明之后,请确保重新启动rails服务器,它应该可以完美地工作。
#5
1
Kind of a noob mistake, but if it helps anyone..
这是个错误,但如果对任何人都有帮助的话。
I added jQuery-ui.js in my assets and then added the gem. Then deleted the js from assets, but my IDE also deleted the same files from the gem.
我添加了jquery ui。js在我的资产中,然后添加了gem。然后从资产中删除js,但我的IDE也从gem中删除了相同的文件。
To resolve, first remove the gem and then run,
要解决这个问题,首先移除宝石,然后运行,
bundle clean --force
and then
然后
bundle install
#6
0
It could just be a matter of restarting WEBrick or any other server you might be using so it picks up the new assets. For WEBrick just go to your terminal window where your server is running and CTRL-C
to terminate the process, after that just restart it again using rails s
or whatever the command to start your server is.
它可能只是重新启动WEBrick或您可能正在使用的任何其他服务器,以便它获取新的资产。对于WEBrick,只要到您的服务器正在运行的终端窗口,并按CTRL-C终止进程,然后使用rails s或任何启动服务器的命令重新启动它。
#1
114
Use specific version of gem "jquery-rails", "~> 2.3.0"
as later version of gem has deleted the ui part.
使用特定版本的gem“jquery-rails”、“~> 2.3.0”,因为后来的gem版本已经删除了ui部分。
or
或
you can use gem "jquery-ui-rails"
for jquery-ui
. For more information please visit the git repository
您可以对jquery-ui使用gem“jquery-ui-rails”。有关更多信息,请访问git存储库。
To require all jQuery UI modules, add the following to your application.js:
要要求所有jQuery UI模块,请向application.js中添加以下内容:
for version 5.0 and more it has been changed. Please follow the link
对于5.0或更多版本,它已经被修改。请按照这个链接
application.js:
application.js:
//= require jquery-ui
application.css:
application.css:
/*
*= require jquery-ui
*/
For lesser version than 5.0 we need to write below format
对于小于5.0的版本,我们需要写在格式下面
application.js:
application.js:
//= require jquery.ui.all
Also add the jQuery UI CSS to your application.css:
还可以将jQuery UI CSS添加到应用程序中。
application.css:
application.css:
/*
*= require jquery.ui.all
*/
Hope this could help you
希望这对你有帮助。
#2
34
I think you are using new version (your version > 2.3.0) of jquery-rails.
我认为您正在使用jquery-rails的新版本(您的版本> 2.3.0)。
jQuery UI has been removed from jquery-rails gem,
jQuery UI已从jQuery -rails gem中删除,
-
≤ jquery-rails v2.3.0
still have jQuery UI - 如果≤jquery-rails 2.3.0还有jQuery UI
-
≥ jquery-rails v3.0.0
jQuery UI removed - ≥jquery-rails v3.0.0 jQuery UI移除
Take a look this commit.
看看这个承诺。
If you are using ≥ jquery-rails v3.0.0
or latest version of jquery-rails
如果您使用的是≥jquery-rails v3.0.0或jquery-rails的最新版本
You should use jquery-ui-rails
gem for using jquery UI in rails, https://github.com/joliss/jquery-ui-rails.
您应该使用jquery- UI -rails gem在rails中使用jquery UI, https://github.com/joliss/jquery-ui-rails。
In your Gemfile, add:
在你Gemfile,添加:
gem 'jquery-ui-rails'
宝石的jquery-ui-rails
and run bundle install
和运行包安装
-
v2.3.0 < your version ≤ v4.2.1
v2.3.0 <版本≤v4.2.1< p>
And put this into
application.js
把这个放到application。js中
//= require jquery.ui.all
then put this into
application.css
然后放到application.css中
*= require jquery.ui.all
-
≥ jquery-ui-rails v5.0.0 or latest version
≥jquery-ui-rails v5.0.0或最新版本
And put this into
application.js
把这个放到application。js中
//= require jquery-ui
then put this into
application.css
然后放到application.css中
*= require jquery-ui
or to use specific modules read this
或者使用特定的模块阅读
Don't forget restart your server.
不要忘记重新启动服务器。
If you are using ≤ jquery-rails v2.3.0
如果您使用的是≤如果jquery-rails 2.3.0
see my answer here https://*.com/a/16996710/1297435 for use gem 'jquery-rails', "~> 2.3.0"
查看我的答案,https://*.com/a/16996710/1297435,使用gem ' jqueryrails ', "~> 2.3.0"
#3
9
The rails 4 answer:
rails 4答:
add to gemfile.rb:
添加gemfile.rb:
gem 'jquery-ui-rails'
add to application.js:
添加application.js:
//= require jquery
//= require jquery-ui
//= require jquery_ujs
to add a specific module:
添加特定模块:
//= require jquery
//= require jquery-ui/yourmodulename
//= require jquery_ujs
I'm not sure if restarting your server is explicitly required but it never hurts anything.
我不确定是否需要重新启动服务器,但是这样做不会有任何影响。
#4
4
I know its a noob mistake but I found this very frustrating and always forget to restart my app after I have installed something new.
我知道这是一个错误,但我发现这是非常令人沮丧的,我总是忘记重启我的应用后,我已经安装了一些新的东西。
Make sure to restart your rails server after you have followed the instructions above and it should work perfectly.
在遵循了上面的说明之后,请确保重新启动rails服务器,它应该可以完美地工作。
#5
1
Kind of a noob mistake, but if it helps anyone..
这是个错误,但如果对任何人都有帮助的话。
I added jQuery-ui.js in my assets and then added the gem. Then deleted the js from assets, but my IDE also deleted the same files from the gem.
我添加了jquery ui。js在我的资产中,然后添加了gem。然后从资产中删除js,但我的IDE也从gem中删除了相同的文件。
To resolve, first remove the gem and then run,
要解决这个问题,首先移除宝石,然后运行,
bundle clean --force
and then
然后
bundle install
#6
0
It could just be a matter of restarting WEBrick or any other server you might be using so it picks up the new assets. For WEBrick just go to your terminal window where your server is running and CTRL-C
to terminate the process, after that just restart it again using rails s
or whatever the command to start your server is.
它可能只是重新启动WEBrick或您可能正在使用的任何其他服务器,以便它获取新的资产。对于WEBrick,只要到您的服务器正在运行的终端窗口,并按CTRL-C终止进程,然后使用rails s或任何启动服务器的命令重新启动它。