programing

'jquery-ui'파일을 찾을 수 없습니다.

nasanasas 2020. 11. 26. 08:26
반응형

'jquery-ui'파일을 찾을 수 없습니다.


내 application.js 파일에 jquery-ui가 있어도 다음 오류가 발생합니다.

'jquery-ui'파일을 찾을 수 없습니다 (/home/jeff/work/projects/a/media/app/assets/javascripts/application.js:14).

application.js

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery.validate.min

아무도 나를 도울 수 있습니까?


gem "jquery-rails", "~> 2.3.0"최신 버전의 gem이 ui 부분을 삭제했기 때문에 특정 버전을 사용하십시오 .

또는

당신이 사용할 수있는 gem "jquery-ui-rails"위해 jquery-ui. 자세한 정보는 git 저장소 를 방문하십시오.

모든 jQuery UI 모듈을 요구하려면 application.js에 다음을 추가하십시오.

버전 5.0 이상에서는 변경되었습니다. 링크를 따라주세요

application.js :

//= require jquery-ui

application.css :

/*
 *= require jquery-ui
 */

5.0 미만 버전의 경우 아래 형식을 작성해야합니다.

application.js :

//= require jquery.ui.all

또한 application.css에 jQuery UI CSS를 추가합니다.

application.css :

/*
 *= require jquery.ui.all
 */

이것이 당신을 도울 수 있기를 바랍니다


jquery-rails의 새 버전 (버전> 2.3.0)을 사용하고 있다고 생각합니다.

jquery-rails gem에서 jQuery UI가 제거되었습니다.

  • ≤ jquery-rails v2.3.0 여전히 jQuery UI가 있습니다.
  • ≥ jquery-rails v3.0.0 jQuery UI 제거

이 커밋을 보세요 .

당신이 사용하는 경우 ≥ jquery-rails v3.0.0또는 JQuery와 레일의 최신 버전

jquery-ui-railsrails, https://github.com/joliss/jquery-ui-rails 에서 jquery UI를 사용 하려면 gem을 사용해야합니다 .

Gemfile에 다음을 추가하십시오.

gem 'jquery-ui-rails'

그리고 실행 bundle install

  1. v2.3.0 <버전 ≤ v4.2.1

    그리고 이것을 application.js

    //= require jquery.ui.all
    

    그런 다음 이것을 application.css

    *= require jquery.ui.all
    
  2. ≥ jquery-ui-rails v5.0.0 또는 최신 버전

    그리고 이것을 application.js

    //= require jquery-ui
    

    그런 다음 이것을 application.css

    *= require jquery-ui
    

    또는 특정 모듈을 사용하려면 이것을 읽으십시오

서버를 다시 시작하는 것을 잊지 마십시오.

사용하는 경우 ≤ jquery-rails v2.3.0

사용하려면 여기 https://stackoverflow.com/a/16996710/1297435 에서 내 대답을 참조하십시오.gem 'jquery-rails', "~> 2.3.0"


레일즈 4 답변 :

gemfile.rb에 추가 :

gem 'jquery-ui-rails'

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.


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.


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.

To resolve, first remove the gem and then run,

bundle clean --force

and then

bundle install

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.

참고URL : https://stackoverflow.com/questions/17830313/couldnt-find-file-jquery-ui

반응형