我的Nuxt项目的“中间件”文件夹中有一个中间件“ get_user_from_jwt.js”。
我已将错误缩小到特定的代码行。
const User = require('../models/User');
该文件包含使用猫鼬的用户对象的架构。
当我运行'npm run dev'时,出现此错误
WARN Compiled with 1 warnings friendly-errors 23:49:01
WARN in ./node_modules/sharp/lib/libvips.js friendly-errors 23:49:01
Critical dependency: the request of a dependency is an expression friendly-errors 23:49:01
friendly-errors 23:49:01
ERROR Failed to compile with 14 errors friendly-errors 23:49:01
These dependencies were not found: friendly-errors 23:49:01
friendly-errors 23:49:01
* child_process in ./node_modules/detect-libc/lib/detect-libc.js, ./node_modules/nodemailer/lib/sendmail-transport/index.js and 1 other
* dns in ./node_modules/nodemailer/lib/mailer/index.js friendly-errors 23:49:01
* fs in ./models/User.js, ./node_modules/bindings/bindings.js and 5 others
* net in ./node_modules/nodemailer/lib/mailer/index.js, ./node_modules/nodemailer/lib/smtp-connection/index.js
* tls in ./node_modules/nodemailer/lib/smtp-connection/index.js friendly-errors 23:49:01
friendly-errors 23:49:01
To install them, you can run: npm install --save child_process dns fs net tls
我的nuxt.config.js文件包含
router: {
middleware: 'get_user_from_jwt'
}
如果我注释了有问题的代码行,它将成功编译,但是如果没有userSchema,我将无能为力。
我该怎么做才能正确编译?
此外,当我导航到正在开发的网页时,会出现此错误
Error message on web browser when i navigate to http://localhost:3000