简体   繁体   English

类型错误:无法读取未定义的属性(读取“原型”)。 Next.Js 和 Express

[英]TypeError: Cannot read properties of undefined (reading 'prototype'). Next.Js and Express

I'm trying to use express in next.js, but errors appears when I try to instantiate express:我试图在next.js中使用express,但是当我尝试实例化express时出现错误:


  const express = require('express');

Errors:错误:

Module not found: Can't resolve 'async_hooks' in 'C:\Users\<user>\<project>\node_modules\on-finished'

Module not found: Can't resolve 'async_hooks' in 'C:\Users\<user>\<project>\node_modules\raw-body'

Edit notes:编辑笔记:

I've already tried npm i我已经尝试过npm i

I'm using node 4.19.0 and express 4.18.2.我正在使用节点 4.19.0 并表示 4.18.2。

when I run npm install -g npm@latest , it says the operation is not permitted.当我运行npm install -g npm@latest时,它说不允许该操作。

Install the latest nodejs and npm version or you can run the below command安装最新的 nodejs 和 npm 版本或者你可以运行下面的命令

npm install -g npm@latest

暂无
暂无

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

相关问题 Next.js | TypeError:无法读取未定义的属性(读取“秘密”) - Next.js | TypeError: Cannot read properties of undefined (reading 'secret') 类型错误:无法读取 Next.js 上未定义的属性(读取“调用”) - TypeError: Cannot read properties of undefined (reading 'call') on Next.js TypeError:无法读取未定义的属性(读取“原型”)React Typescript + Express - TypeError: Cannot read properties of undefined (reading 'prototype') React Typescript + Express 错误 - 类型错误:使用 next.js 中的 redux 存储时无法读取未定义的属性(读取“getState”) - error - TypeError: Cannot read properties of undefined (reading 'getState') while using redux store in next.js Next.js &amp; Firebase -&gt; TypeError:无法读取未定义的属性(读取“应用程序”) - Next.js & Firebase -> TypeError: Cannot read properties of undefined (reading 'apps') Mongoose 和 Next.js:未处理的运行时错误 TypeError:无法读取未定义的属性(读取“令牌”) - Mongoose and Next.js: Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'Token') TypeError:无法读取 Next.js 中 null 的属性(读取“默认”) - TypeError: Cannot read properties of null (reading 'default') in Next.js Next.js - 类型错误:无法读取 null 的属性(读取“useMemo”) - Next.js - TypeError: Cannot read properties of null (reading 'useMemo') Next.js:无法读取未定义的属性(读取“indexOf”) - Next.js: Cannot read properties of undefined (reading 'indexOf') Next.js 错误:无法读取未定义的属性(读取“集合”) - Next.js Error: Cannot read properties of undefined (reading 'collection')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM