PS C:\用户 iski\OneDrive\Desktop\FULLSTACK ackend> npm start

问题描述 投票:0回答:1

PS C:\用户 iski\OneDrive\Desktop\FULLSTACK ackend> npm start

[电子邮件受保护]开始 Nodemon索引.js

[nodemon] 3.1.7 [nodemon] 随时重启,输入

rs
[nodemon] 观察路径:. [nodemon] 观看扩展:js,mjs,cjs,json [nodemon] 开始
node index.js index.js
节点:内部/模块/cjs/loader:1228 抛出错误; ^

错误:找不到模块“C:\Users” iski\OneDrive\Desktop\FULLSTACK ackend\index.js' 在 Module._resolveFilename (节点:内部/模块/cjs/loader:1225:15) 在 Module._load (节点:内部/模块/cjs/loader:1051:27) 在 Function.executeUserEntryPoint [作为 runMain] (节点:内部/模块/run_main:174:12) 在节点:内部/主/run_main_module:28:49 { 代码:'MODULE_NOT_FOUND', 需要堆栈:[] }

Node.js v20.17.0 [nodemon] 应用程序崩溃 - 启动前等待文件更改...

活动节点index.js

javascript node.js
1个回答
-1
投票

此错误的原因是:

  1. 缺少文件:“C:\Users”处缺少文件“index.js” iski\OneDrive\Desktop\FULLSTACK ackend"

  2. 文件名不正确:如果主文件被命名为其他名称(检查是否区分大小写,例如“Index.js”)而不是index.js,请确保将其更改为“index.js”

  3. 文件路径问题:确保您位于正确的目录(“C:\Users iski\OneDrive\Desktop\FULLSTACK ackend") 在执行命令之前。

  4. Package.json:确保package.json文件具有正确的文件名

"scripts": { "start": "nodemon <correct-file-name>.js" }

© www.soinside.com 2019 - 2024. All rights reserved.