admin管理员组

文章数量:1318563

I recently started using Nodemon. But when I run this command "nodemon server.js", comes this:

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

This is my package.json file:

{
  "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": ""
}

The problem is that Nodemon tries to start two files. How can I fix it? I have no nodemon.json file or similar. I installed Nodemon with npm install nodemon

I recently started using Nodemon. But when I run this command "nodemon server.js", comes this:

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

This is my package.json file:

{
  "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": ""
}

The problem is that Nodemon tries to start two files. How can I fix it? I have no nodemon.json file or similar. I installed Nodemon with npm install nodemon

Share Improve this question edited Jan 21 at 12:00 mastahlb asked Jan 21 at 10:50 mastahlbmastahlb 395 bronze badges 2
  • 1 Could you please update your post with the contents of your package.json file? – David R Commented Jan 21 at 11:34
  • ...why do you have main set to your tailwind config in your package.json? – Jared Smith Commented Jan 21 at 13:46
Add a comment  | 

1 Answer 1

Reset to default 1

The issue is caused by the "main": "tailwind.config.js" property in your package.json file. When you run nodemon server.js, nodemon reads the main property and tries to include tailwind.config.js as well.

Update the "main" property in package.json to point to your entry file, server.js

本文标签: javascriptNodemon dont start the serverjsStack Overflow