简体   繁体   English

未捕获的TypeError:r不是index.js:1的函数

[英]Uncaught TypeError: r is not a function at index.js:1

Laravel Project on Virtual Dedicated Server. 虚拟专用服务器上的Laravel项目。 After building with npm run production I'm opening page via Chrome and see only blank page. 使用npm run production我将通过Chrome打开页面,仅看到空白页面。 Console showed me this error. 控制台向我显示此错误。 I'm tryed to add some plugins in webpack.mix.js, like 'babel-polyfill' and no result. 我试图在webpack.mix.js中添加一些插件,例如“ babel-polyfill”,但没有结果。 Laravel framework 5.4.36 npm version 3.10.10 Laravel Framework 5.4.36 npm版本3.10.10

Here is my app.blade.php 这是我的app.blade.php

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, maximum-scale=1, minimum-scale=1" > <!-- CSRF Token --> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <!-- Styles --> <link rel="stylesheet" href="{{ elixir('css/app.css') }}"> <!-- Scripts --> <script> window.Laravel = <?php echo json_encode([ 'csrfToken' => csrf_token(), ]); ?> </script> </head> <body> <div id="react-container"></div> <!-- Scripts --> <script> var MapInstance; </script> <script src="{{ mix('js/app/manifest.js') }}"></script> <script src="{{ mix('js/app/vendor.js') }}"></script> <script src="{{ mix('js/app/index.js') }}"></script> </body> </html> 

and my webpack.mix.js 和我的webpack.mix.js

 let mix = require('laravel-mix'); mix .react('resources/assets/js/app/index.jsx', 'public/js/app') .sass('resources/assets/sass/app.scss', 'public/css') .sass('resources/assets/sass/start.scss', 'public/css') .copy('node_modules/material-design-lite/material.min.js', 'public/vendor/material.min.js') .copy('node_modules/material-design-lite/material.min.js.map', 'public/vendor/material.min.js.map') .copy('node_modules/jquery/dist/jquery.min.js', 'public/vendor/jquery.min.js') .sourceMaps() .browserSync('ap.dev'); if (mix.inProduction()) { mix.version(); } 

You have to add JQuery before Material in webpack.mix.js : 您必须在webpack.mix.js Material之前添加JQuery:

// ...

.copy(
    'node_modules/jquery/dist/jquery.min.js', 
    'public/vendor/jquery.min.js'
)
.copy(
    'node_modules/material-design-lite/material.min.js',
    'public/vendor/material.min.js'
)
.copy(
    'node_modules/material-design-lite/material.min.js.map',
    'public/vendor/material.min.js.map'
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 index.js:354 未捕获类型错误:document.getElementsAtEvent 不是 function - index.js:354 Uncaught TypeError: document.getElementsAtEvent is not a function index.js:8 未捕获类型错误:无法读取 index.js:8 处未定义的属性“addEventListener”, - index.js:8 Uncaught TypeError: Cannot read property 'addEventListener' of undefined at index.js:8, index.js:33 未捕获的类型错误:无法在 loadQuiz 中读取未定义的属性“问题”(index.js:33) - index.js:33 Uncaught TypeError: Cannot read property 'question' of undefined at loadQuiz (index.js:33) React JS Google Maps距离矩阵错误:未被捕获的TypeError:location.join不是formatLocations的函数(index.js:45) - React JS Google Maps Distance Matrix Error: Uncaught TypeError: locations.join is not a function at formatLocations (index.js:45) 如何解决 index.js:9 Uncaught TypeError: Cannot read property &#39;setWallpaper&#39; of undefined? - How to resolve index.js:9 Uncaught TypeError: Cannot read property 'setWallpaper' of undefined? Index.js:46 未捕获的类型错误:无法读取未定义的属性“生活方式” - Index.js:46 Uncaught TypeError: Cannot Read Property 'lifestyle' Of Undefined index.js:28 未捕获类型错误:无法读取 null 的属性“addEventListener”(在 toggleActiveOnClick 和 Array.forEach 中) - index.js:28 Uncaught TypeError: Cannot read property 'addEventListener' of null ( at toggleActiveOnClick and at Array.forEach) 未捕获的类型错误:无法在 HTMLButtonElement 处设置 null 的属性“textContent”。<anonymous> (index.js:17),为什么会这样?</anonymous> - Uncaught TypeError: Cannot set property 'textContent' of null at HTMLButtonElement.<anonymous> (index.js:17), why is it happening? index.js:1 Uncaught SyntaxError: 意外的标记 < - index.js:1 Uncaught SyntaxError: Unexpected token < 未捕获的类型错误:$ 不是 function 在(索引):2 - Uncaught TypeError: $ is not a function at (index):2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM