我最近开始使用 Nodemon。但是当我运行这个命令“nodemon server.js”时,出现这个:
nodemon server.js
[nodemon] 3.1.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node server.js tailwind.config.js`
[nodemon] clean exit - waiting for changes before restart
这是我的 package.json 文件:
{
"devDependencies": {
"crypto-browserify": "^3.12.1",
"tailwindcss": "^3.4.17"
},
"dependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@otplib/preset-browser": "^12.0.1",
"body-parser": "^1.20.3",
"cors": "^2.8.5",
"dotenv": "^16.4.7",
"esbuild-plugins-node-modules-polyfill": "^1.6.8",
"express": "^4.21.2",
"grep": "^0.1.0",
"motion": "^11.18.0",
"mysql2": "^3.12.0",
"otplib": "^12.0.1",
"qrcode": "^1.5.4"
},
"name": "bandashboard",
"version": "1.0.0",
"main": "tailwind.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"dev": "nodemon server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"description": ""
}
问题是 Nodemon 尝试启动两个文件。我该如何修复它?我没有 nodemon.json 文件或类似文件。我用
npm install nodemon
安装了 Nodemon
该问题是由
"main": "tailwind.config.js"
文件中的 package.json
属性引起的。当您运行 nodemon server.js
时,nodemon
会读取主属性并尝试包含 tailwind.config.js
。
更新
"main"
中的 package.json
属性以指向您的条目文件,server.js