简体   繁体   中英

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:


  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

I'm using node 4.19.0 and express 4.18.2.

when I run npm install -g npm@latest , it says the operation is not permitted.

Install the latest nodejs and npm version or you can run the below command

npm install -g npm@latest

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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