获得;“连接未熔合的ECONREFUSE”;当我;npm运行种子“;在mongodb的api中
我正在学习反应和羽毛。对于我在react中制作的recipes应用程序,我使用feathers api和mongodb。我在获得;“连接未熔合的ECONREFUSE”;当我;npm运行种子“;在mongodb的api中,mongodb,api,npm,feathersjs,Mongodb,Api,Npm,Feathersjs,我正在学习反应和羽毛。对于我在react中制作的recipes应用程序,我使用feathers api和mongodb。我在/src/seeds.js中有一些种子作为示例,刚开始在feathers中设置所有内容,但当我想运行我的种子(npm run seed)并检查它是否在feathers上工作时localhost:3030/recipes我遇到了以下错误: Error creating user! { Error: connect ECONNREFUSED 127.0.0.1:3030
/src/seeds.js
中有一些种子作为示例,刚开始在feathers中设置所有内容,但当我想运行我的种子(npm run seed
)并检查它是否在feathers上工作时localhost:3030/recipes
我遇到了以下错误:
Error creating user! { Error: connect ECONNREFUSED 127.0.0.1:3030
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3030,
response: undefined }
我不知道错误是因为连接或创建用户!
我检查了我的mondo db,它运行
这是package.json,以防万一:
{
"name": "recipes-api(par)",
"description": "api for recipes app",
"version": "0.0.0",
"homepage": "",
"main": "src/",
"keywords": [
"feathers"
],
"license": "MIT",
"repository": {},
"author": {},
"contributors": [],
"bugs": {},
"engines": {
"node": ">= 0.12.0"
},
"scripts": {
"test": "npm run jshint && npm run mocha",
"jshint": "jshint src/. test/. --config",
"start": "node src/",
"mocha": "mocha test/ --recursive",
"seed": "node src/seeds.js"
},
"dependencies": {
"body-parser": "^1.17.1",
"compression": "^1.6.2",
"cors": "^2.8.3",
"feathers": "^2.1.1",
"feathers-authentication": "^0.7.12",
"feathers-client": "^2.2.0",
"feathers-configuration": "^0.3.3",
"feathers-errors": "^2.6.3",
"feathers-hooks": "^1.8.1",
"feathers-mongoose": "^3.6.2",
"feathers-rest": "^1.7.2",
"feathers-socketio": "^1.6.0",
"mongoose": "^4.9.6",
"passport": "^0.3.2",
"serve-favicon": "^2.4.2",
"superagent": "^3.5.2",
"winston": "^2.3.1"
},
"devDependencies": {
"jshint": "^2.9.4",
"mocha": "^3.3.0",
"request": "^2.81.0"
}
}
在添加种子之前,我应该在http://localhost:3030/recipes
我仍然拥有它,但在运行种子之后,我应该会看到我的食谱列表
我还需要从我的代码中复制其他东西吗?有什么想法吗?检查您的数据库是否包含种子数据。如果不是,则可能是因为
127.0.0.1:3030
不可用。它可能正在另一个端口上运行。为此,请检查您的/config/default.json
。默认情况下,在种子设定之前,如果您的服务可用,请执行类似http://localhost:3030/
应显示{“总计”:0,“限制”:10,“跳过”:0,“数据”:[]}
@Jalil这是我的默认值。json
:{“主机”:“本地主机”,“端口”:3030,“mongodb”:mongodb://localhost:27017/recipesApi“,”公共“:“./public/”,“auth”:{“token”:{“secret”:“4QRMWFG9QCRX5EDMHCLDPE4XFiryQX1U+Enbo2fE/iY7YZ9mvjR28ZZpQx1/wkn3ljHSAIVlNXjnUXIkWZHLw=”,“local”:{}
我现在给你的建议是更新版本,因为你仍然在使用旧的0.7.x。还有feathers cli
,将向您展示它们的结构,它还将使用最新版本的feathers。我更新了feathers并再次生成api应用程序。在新版本中,它甚至不为我生成模型。我自己做了模型,现在根本不起作用了。新版本越来越复杂了。我想我要看看它的文档。无论如何谢谢你。是的,现在真的很混乱,因为你是在feathers有重大更新的时候开始的。下载最新版本。请参阅文档和命令。这是很好的设置您的第一个项目,并作为参考。