CKeditor return “CKEditor is not defined” in Laravel











up vote
0
down vote

favorite












When integrating CKeditor in Laravel. It returns error:



GET http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js net::ERR_ABORTED 404 (Not Found)



Uncaught ReferenceError: CKEditor is not defined
at add:88



This is my code:



<script src="vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<textarea id="editor1" ></textarea>

<script>
CKEDITOR.replace( 'editor1' );
</script>


There are questions with the same problem, but none helped me










share|improve this question




























    up vote
    0
    down vote

    favorite












    When integrating CKeditor in Laravel. It returns error:



    GET http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js net::ERR_ABORTED 404 (Not Found)



    Uncaught ReferenceError: CKEditor is not defined
    at add:88



    This is my code:



    <script src="vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
    <textarea id="editor1" ></textarea>

    <script>
    CKEDITOR.replace( 'editor1' );
    </script>


    There are questions with the same problem, but none helped me










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      When integrating CKeditor in Laravel. It returns error:



      GET http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js net::ERR_ABORTED 404 (Not Found)



      Uncaught ReferenceError: CKEditor is not defined
      at add:88



      This is my code:



      <script src="vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
      <textarea id="editor1" ></textarea>

      <script>
      CKEDITOR.replace( 'editor1' );
      </script>


      There are questions with the same problem, but none helped me










      share|improve this question















      When integrating CKeditor in Laravel. It returns error:



      GET http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js net::ERR_ABORTED 404 (Not Found)



      Uncaught ReferenceError: CKEditor is not defined
      at add:88



      This is my code:



      <script src="vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
      <textarea id="editor1" ></textarea>

      <script>
      CKEDITOR.replace( 'editor1' );
      </script>


      There are questions with the same problem, but none helped me







      javascript php laravel ckeditor






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 11:25









      Mehran

      138210




      138210










      asked Nov 11 at 7:48









      Ismoilov Amir

      85




      85
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You must first publish vendor with:



          php artisan vendor:publish --tag=ckeditor


          And then use the asset helper function to address the script file:



            <script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>


          or



            <script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>


          This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function



          This should print out this:



          http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)


          Instead of this:



          http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)





          share|improve this answer























          • Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
            – Ismoilov Amir
            Nov 11 at 9:05












          • did you publish the vendor? @IsmoilovAmir
            – Salar Bahador
            Nov 11 at 9:18










          • Salar Bahador, i did it. Publishing complete
            – Ismoilov Amir
            Nov 11 at 9:21










          • @IsmoilovAmir is vendor directory created in public directory?
            – Salar Bahador
            Nov 11 at 9:25










          • Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
            – Ismoilov Amir
            Nov 11 at 9:30











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246804%2fckeditor-return-ckeditor-is-not-defined-in-laravel%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          You must first publish vendor with:



          php artisan vendor:publish --tag=ckeditor


          And then use the asset helper function to address the script file:



            <script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>


          or



            <script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>


          This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function



          This should print out this:



          http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)


          Instead of this:



          http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)





          share|improve this answer























          • Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
            – Ismoilov Amir
            Nov 11 at 9:05












          • did you publish the vendor? @IsmoilovAmir
            – Salar Bahador
            Nov 11 at 9:18










          • Salar Bahador, i did it. Publishing complete
            – Ismoilov Amir
            Nov 11 at 9:21










          • @IsmoilovAmir is vendor directory created in public directory?
            – Salar Bahador
            Nov 11 at 9:25










          • Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
            – Ismoilov Amir
            Nov 11 at 9:30















          up vote
          0
          down vote













          You must first publish vendor with:



          php artisan vendor:publish --tag=ckeditor


          And then use the asset helper function to address the script file:



            <script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>


          or



            <script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>


          This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function



          This should print out this:



          http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)


          Instead of this:



          http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)





          share|improve this answer























          • Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
            – Ismoilov Amir
            Nov 11 at 9:05












          • did you publish the vendor? @IsmoilovAmir
            – Salar Bahador
            Nov 11 at 9:18










          • Salar Bahador, i did it. Publishing complete
            – Ismoilov Amir
            Nov 11 at 9:21










          • @IsmoilovAmir is vendor directory created in public directory?
            – Salar Bahador
            Nov 11 at 9:25










          • Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
            – Ismoilov Amir
            Nov 11 at 9:30













          up vote
          0
          down vote










          up vote
          0
          down vote









          You must first publish vendor with:



          php artisan vendor:publish --tag=ckeditor


          And then use the asset helper function to address the script file:



            <script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>


          or



            <script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>


          This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function



          This should print out this:



          http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)


          Instead of this:



          http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)





          share|improve this answer














          You must first publish vendor with:



          php artisan vendor:publish --tag=ckeditor


          And then use the asset helper function to address the script file:



            <script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>


          or



            <script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>


          This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function



          This should print out this:



          http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)


          Instead of this:



          http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 11 at 9:29

























          answered Nov 11 at 8:18









          Salar Bahador

          4251313




          4251313












          • Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
            – Ismoilov Amir
            Nov 11 at 9:05












          • did you publish the vendor? @IsmoilovAmir
            – Salar Bahador
            Nov 11 at 9:18










          • Salar Bahador, i did it. Publishing complete
            – Ismoilov Amir
            Nov 11 at 9:21










          • @IsmoilovAmir is vendor directory created in public directory?
            – Salar Bahador
            Nov 11 at 9:25










          • Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
            – Ismoilov Amir
            Nov 11 at 9:30


















          • Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
            – Ismoilov Amir
            Nov 11 at 9:05












          • did you publish the vendor? @IsmoilovAmir
            – Salar Bahador
            Nov 11 at 9:18










          • Salar Bahador, i did it. Publishing complete
            – Ismoilov Amir
            Nov 11 at 9:21










          • @IsmoilovAmir is vendor directory created in public directory?
            – Salar Bahador
            Nov 11 at 9:25










          • Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
            – Ismoilov Amir
            Nov 11 at 9:30
















          Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
          – Ismoilov Amir
          Nov 11 at 9:05






          Salar Bahador, i edit it how you suggested. But i take the same error with print: 127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js
          – Ismoilov Amir
          Nov 11 at 9:05














          did you publish the vendor? @IsmoilovAmir
          – Salar Bahador
          Nov 11 at 9:18




          did you publish the vendor? @IsmoilovAmir
          – Salar Bahador
          Nov 11 at 9:18












          Salar Bahador, i did it. Publishing complete
          – Ismoilov Amir
          Nov 11 at 9:21




          Salar Bahador, i did it. Publishing complete
          – Ismoilov Amir
          Nov 11 at 9:21












          @IsmoilovAmir is vendor directory created in public directory?
          – Salar Bahador
          Nov 11 at 9:25




          @IsmoilovAmir is vendor directory created in public directory?
          – Salar Bahador
          Nov 11 at 9:25












          Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
          – Ismoilov Amir
          Nov 11 at 9:30




          Salar Bahador, yes i have directory vendor in public directory. But there no ckeditor's data. All data of ckeditor are located in root/vendor/unisharp
          – Ismoilov Amir
          Nov 11 at 9:30


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246804%2fckeditor-return-ckeditor-is-not-defined-in-laravel%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues