[英]Browserify gives me Uncaught TypeError: Cannot read property 'prototype' of undefined
I have tried installing npm browserify globally with a command npm i -g browserify
.我尝试使用命令
npm i -g browserify
全局安装 npm npm i -g browserify
。 Then I wrote in terminal browserify app.js -o bundle.js
command, which created bundle.js file, and then I went to my index.html and I changed my script to <script defer src="bundle.js"/>
.然后我在终端浏览器中编写
browserify app.js -o bundle.js
命令,它创建了 bundle.js 文件,然后我去我的 index.html 并将我的脚本更改为<script defer src="bundle.js"/>
. I went to check and indeed error Uncaught referenceError: require is not defined is gone, but I have this new error:我去检查,确实错误 Uncaught referenceError: require is not defined 消失了,但我有这个新错误:
bundle.js:41149 Uncaught TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (bundle.js:41149)
at Object.236../utils (bundle.js:42251)
at o (bundle.js:1)
at bundle.js:1
at Object.232../application (bundle.js:40389)
at o (bundle.js:1)
at bundle.js:1
at Object.230../lib/express (bundle.js:39717)
at o (bundle.js:1)
at bundle.js:1
(anonymous) @ bundle.js:41149
236../utils @ bundle.js:42251
o @ bundle.js:1
(anonymous) @ bundle.js:1
232../application @ bundle.js:40389
o @ bundle.js:1
(anonymous) @ bundle.js:1
230../lib/express @ bundle.js:39717
o @ bundle.js:1
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:36124
206._process @ bundle.js:36133
o @ bundle.js:1
r @ bundle.js:1
(anonymous) @ bundle.js:1
This is my app.js file, index html has nothing in it.这是我的 app.js 文件,索引 html 中没有任何内容。 And bundle.js has like 60k lines of code, I can't show it.
bundle.js 有 60k 行代码,我无法显示。
const express = require("express");
const app = express();
const PORT = process.env.PORT || 5500;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.