错误:internal/modules/cjs/loader.js:968 抛出错误;节点模块?

2024-01-25

我正在关注 this https://www.youtube.com/watch?v=xZMwg5z5VGkYouTube 教程系列,但在运行服务器时我突然遇到了这个问题 我尝试将节点重新卸载到最新的稳定版本。

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'D:\DATA\Learning\Creations\WEB\website\tabs tracker\Vue-and-Express.JS\server\scr\app.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

app.js的代码

const express = require('express')
const bodyParser = require('body-parser')
const morgan = require('morgan')
const cors = require('cors')
const { sequelize } = require('./models')
const config = require('./config/config')

const app = express()

app.use(morgan('combined'))
app.use(bodyParser.json())
app.use(cors())

require('./routes')(app)

sequelize.sync().then(() => {
  app.listen(config.port)
  console.log(`Serverstarted on port ${config.port}`)
})

包.json

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node ./node_modules/nodemon/bin/nodemon.js scr/app.js --exec \"npm run lint && node\"",
    "lint": "./node_modules/.bin/eslint **/*.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "joi": "^17.2.0",
    "morgan": "^1.10.0",
    "sequelize": "^6.3.4",
    "sqlite3": "^5.0.0"
  },
  "devDependencies": {
    "eslint": "^7.7.0",
    "nodemon": "^2.0.4",
    "eslint-config-standard": "^14.1.1",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "eslint-plugin-vue": "^6.2.2"
  }
}


我认为您导入的代码中的某处存在拼写错误'app' as /scr/app代替src/app

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

错误:internal/modules/cjs/loader.js:968 抛出错误;节点模块? 的相关文章

  • 全局传递 xhr onload 函数的值

    在我正在创建的应用程序中 我有以下 XMLHttpRequest 并且我正在尝试传递结果data在 的里面xhr onload 到在同一父函数中创建的数组中 var url http api soundcloud com resolve j
  • 在文件之间共享 mqtt 客户端对象

    我这样连接到 MQTT mqtt js const mqtt require mqtt var options needed options var client mqtt connect mqtt someURL options clie
  • Meteor.setTimeout 和 Meteor.methods 之间的并发

    在我的 Meteor 应用程序中实现回合制多人游戏服务器 客户端通过发布 订阅接收游戏状态 并且可以调用 Meteor 方法sendTurn将回合数据发送到服务器 他们无法直接更新游戏状态集合 var endRound function g
  • npmjs.org - 找不到自述文件

    我是 npm 包的主要作者scramjet 一个月以来 我遇到了关于可视性的问题README md在 npmjs 中 The npm 中的超燃冲压发动机包 https www npmjs com package scramjet shows
  • 缺少节点-v59-linux-x64/grpc_node.node

    我正在尝试在我的服务器中使用 Firebase admin SDK 当我部署时 出现错误 我在 firebase admin node module 映射中缺少文件 node v59 linux x64 grpc node node 我在包
  • NestJS e2e 测试模拟会话装饰器

    我正在尝试使用 supertest 编写一个 e2e 测试 其中我的控制器实际上使用了 Session 装饰师 然而 我不想承担使用数据库连接等启动会话的全部负担 因此测试中的我的应用程序实际上并未初始化会话 相反 我想首先模拟掉装饰器提供
  • firebase 和 firebase-admin npm 模块有什么区别?

    我想使用 Firebase 身份验证 数据库和存储 构建 Node js Web 应用程序 但我对应该使用哪个模块感到困惑 firebase or firebase 管理员 或两者 管理 SDK 运行您的代码管理权限 https fireb
  • Cosmos DB Mongo API 如何管理“请求率很大”情况

    我有以下代码 async function bulkInsert db collectionName documents try const cosmosResults await db collection collectionName
  • 找不到“节点”的类型定义文件

    更新 Angular Webpack 和 TypeScript 后出现奇怪的错误 知道我可能会错过什么吗 当我使用 npm start 运行应用程序时 出现以下错误 at loader Cannot find type definition
  • 根据特定字符获取整个字符串或子字符串

    我有一个包含 MIME 类型的字符串 例如application json 现在我想将其与实际的 HTTP 标头进行比较 在本例中content type 如果标头包含 MIME 类型 那么就很简单 if mimeType contentT
  • 下载中带有文件名的 NodeJS sendFile

    我尝试使用以下代码将文件发送给客户端 router get get myfile function req res next res sendFile other file name dat 它工作正常 但当用户从以下网址下载此文件时我需要
  • 如何在超级测试中模拟中间件?

    我想测试中间件是否在app js叫做 虽然我嘲笑该模块work js 它仍然运行原始代码 app js const work require work const express require require const app expr
  • 在 Node.js 中,setTimeout() 会阻止事件循环吗?

    如果我有一个简单的 setTimeout 函数 并将其设置为 10 秒 整个服务器在那10秒内就死机了 这是真的 这就是我听到的 答案是no 你的链接是什么Node js 如何重新创建 setTimeout 函数而不阻塞事件循环 https
  • 使用 KeystoneJs 的 Mongoose 二级种群 [重复]

    这个问题在这里已经有答案了 我需要用 Mongoose Keystone 填充两层 但遇到了障碍 我有 3 个模型 地区 国家和城市 地区包含国家 国家包含城市 我的模型 型号区域 var Region new keystone List
  • 如何使用remark将markdown解析为json

    The 备注站点 https remark js org 有一个 AST 浏览器的链接 用于输出备注 https astexplorer net gist 0a92bbf654aca4fdfb3f139254cf0bad ffe102014
  • 我在 MacBook M1 max 中的 nodejs 连接到数据库 oracle 时遇到问题帮助我

    Node js 中的错误消息 nodemon 启动node server js错误 错误 DPI 1047 无法找到 64 位 Oracle 客户端库 dlopen Users pitidev ldb Downloads instantcl
  • Plesk Windows 部署 Node.js

    我创建了一个以 Node js 作为后端的 Angular 项目 这是服务器文件结构 Home directory httpdocs node hm dist browser folder server folder server js p
  • 如何检查请求是否通过 Express 中的 https 发送

    我想强制某些路线始终在我的 Express 应用程序中使用安全连接 我如何检查以确保它使用 https 我在 heroku 上使用搭载 ssl 进行部署 我也在 Heroku 上部署 当他们使用 nginx 进行反向代理时 他们添加了一堆标
  • 未捕获的错误:找不到模块“jquery”

    我在用Electron https github com atom electron制作桌面应用程序 在我的应用程序中 我正在加载一个外部站点 Atom 应用程序之外 可以说http mydummysite index html http
  • 流星内存不足

    我正在使用流星来制作报废引擎 我必须执行一个 HTTP GET 请求 这会向我发送一个 xml 但这个 xml 大于 400 ko 我得到一个异常 内存不足 result Meteor http get http SomeUrl com 致

随机推荐