繁体   English   中英

Browserify 给了我未捕获的类型错误:无法读取未定义的属性“原型”

[英]Browserify gives me Uncaught TypeError: Cannot read property 'prototype' of undefined

我尝试使用命令npm i -g browserify全局安装 npm npm i -g browserify 然后我在终端浏览器中编写browserify app.js -o bundle.js命令,它创建了 bundle.js 文件,然后我去我的 index.html 并将我的脚本更改为<script defer src="bundle.js"/> . 我去检查,确实错误 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

这是我的 app.js 文件,索引 html 中没有任何内容。 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM