![](/img/trans.png)
[英]Uncaught TypeError : cannot read property 'prototype' of undefined
[英]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.