NodeJS 节点服务器未在本地主机和控制台上启动

5us2dqdw  于 2022-12-12  发布在  Node.js
关注(0)|答案(1)|浏览(133)

我一直在尝试启动节点服务器:

PS C:\Users\PCUSER\Documents\Tuts\node-course> nodemon app.js 
[nodemon] 2.0.20 
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.* 
[nodemon] watching extensions: js,mjs,json 
[nodemon] starting`node app.js index.js\`
node:internal/modules/cjs/loader:998
throw err;
^

Error: Cannot find module 'C:\\Users\\PCUSER\\Tuts\\node-course\\index.js'
at Module.\_resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module.\_load (node:internal/modules/cjs/loader:841:27)
at Function.executeUserEntryPoint \[as runMain\] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: \[\]
}

Node.js v18.12.1
\[nodemon\] app crashed - waiting for file changes before starting.
\
wooyq4lh

wooyq4lh1#

转到您的package.json文件,并选中要设置nodemon以启动的文件
例如,脚本{“开始”:“nodemon索引. js”

}

相关问题