猫鼬“不支持选项”

时间:2018-12-31 03:52:45

标签: node.js reactjs mongodb express mongoose

当我使用yarn start时,我遇到所有这些“不支持”选项错误。该项目利用了MERN堆栈。根据我的Google调查,我非常确定这与Mongoose设置选项有关,但我不知道在哪里寻找位置或下一步如何解决问题。
error page

Here is my server.js  `//Bring in Depedencies
const express = require("express");
const bodyParser = require("body-parser");
const mongoose = require("mongoose");
const routes = require("./routes");
const app = express();
const PORT = process.env.PORT || 3001;

//Define middleware
app.use(bodyParser.urlencoded({ extended: true}));
app.use(bodyParser.json());
//Serve up static assets on heroku
if(process.env.NODE_ENV === "production") {
    app.use(express.static("client/build"));
}
//Add routes, both API and view
app.use(routes);

//Connect to the Mongo DB
mongoose.connect("mongodb://localhost:27017/hotsheetmedical", { useNewUrlParser: true });


//Start the API Server
app.listen(PORT, function() {
    console.log(`  ==> API Server now listening on PORT ${PORT}!`);
})`

据我的package.json。可能是因为这个原因,因为我有两个package.json。当我克隆git存储库时创建了一个。另一个是使用create-react-app创建的。我被指示这样做,但是很确定这会引起问题……或者如果还没有的话,那会造成问题。

这是package.json,它在我的server.js的主目录中

{
  "dependencies": {
    "axios": "^0.18.0",
    "body-parser": "^1.18.3",
    "express": "^4.16.4",
    "express-router": "^0.0.1",
    "if-env": "^1.0.4",
    "mongod": "^2.0.0",
    "mongoose": "^5.4.0",
    "react": "^16.7.0",
    "react-dom": "^16.7.0",
    "react-router": "^4.3.1",
    "react-router-dom": "^4.3.1",
    "reactstrap": "^6.5.0"
  },
  "scripts": {
    "start": "node server.js"
  },
  "name": "hotsheetmedical",
  "version": "1.0.0",
  "main": "server.js",
  "devDependencies": {},
  "author": "",
  "license": "ISC",
  "description": ""
}

这是使用Create-react-app创建的package.json,位于客户端文件夹

{
  "name": "hotsheetmedical",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.6.3",
    "react-dom": "^16.6.3",
    "react-scripts": "2.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

请告诉我是否还有其他可以帮助您的信息。同时也感谢您的指导。我敢肯定这是一个愚蠢的新手错误,我看不到。

0 个答案:

没有答案