Getting "connect ECONNREFUSED" error when I "npm run seed" in feathers api with mongodb - mongodb

I'm learning react and feathers. For my recipes app that I've made in react I use feathers api and mongodb. I have some seeds as examples in /src/seeds.js and just began to set up everything in feathers but when I want to run my seeds(npm run seed) and check if it works on feathers localhost:3030/recipes I got this error:
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 }
I don't know the error is because of connection or creating user!
I checked my mondo db, it runs.
this is package.json, just in case:
{
"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"
}
}
Before adding seeds I should have seen {"total":0,"limit":5,"skip":0,"data":[]} in http://localhost:3030/recipes that I'm still having it but after running seeds I should see the list of my recipes.
Anythings else that I need to copy here from my code? any idea?

Related

Error: Jest: Got error running globalSetup ../#shelf/jest-mongodb/setup.js, reason: Instance Exited before being ready and without throwing an error

I'm following the documentation on jestjs.io. When I try to run a test I get this error:
Error: Jest: Got error running globalSetup - /home/.../node_modules/#shelf/jest-mongodb/setup.js, reason: Instance Exited before being ready and without throwing an error!
This happened both when I've used typescript and also when I created a simple app using javascript instead:
package.json:
{
"name": "mongojest",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"#shelf/jest-mongodb": "^3.0.1"
},
"scripts": {
"test": "jest"
},
"dependencies": {
"jest": "^28.1.0"
}
}
jest.config.js:
module.exports = {
coverageProvider: "v8",
"preset": "#shelf/jest-mongodb"
};
I haven't made any changes other than the minimum installs to get it running.
I got around this issue by installing Ubuntu 20.04. I was using the newer Ubuntu 22.04 and it seem to have caused some issues.
I installed typescript in my project. That was enough to run. Follow my configuration files
//package.json
{
"name": "research-with-programmers-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --passWithNoTests --silent --noStackTrace --runInBand",
"test:verbose": "jest --passWithNoTests --runInBand",
"test:unit": "yarn test -- --watch -c jest-unit-config.ts",
"test:integration": "yarn test -- --watch -c jest-integration-config.ts",
"test:staged": "yarn test -- --findRelatedTest",
"test:ci": "yarn test -- --coverage"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#shelf/jest-mongodb": "^4.1.0",
"#types/bcrypt": "^5.0.0",
"#types/jest": "^28.1.8",
"#types/mongodb": "^4.0.7",
"#types/node": "^18.7.13",
"#types/validator": "^13.7.6",
"#typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^22.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"git-commit-msg-linter": "^4.1.3",
"husky": "^8.0.1",
"jest": "^29.0.1",
"lint-staged": "^13.0.3",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "^4.8.2"
},
"dependencies": {
"bcrypt": "^5.0.1",
"mongodb": "^4.10.0",
"validator": "^13.7.0"
}
}
//jest-config.ts
export default {
roots: ['<rootDir>/src'],
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!<rootDir>/src/**/protocols/*.ts',
'!<rootDir>/src/**/*protocols.ts',
'!<rootDir>/src/**/models/*.ts',
'!<rootDir>/src/**/usecases/*.ts',
'!<rootDir>/src/**/index.ts'
],
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
testEnvironment: 'node',
preset: '#shelf/jest-mongodb',
transform: {
'.+\\.ts$': 'ts-jest'
}
}
// jest-mongodb-config.ts
export default {
mongodbMemoryServerOptions: {
instance: {
dbName: 'jest'
},
binary: {
version: '4.0.3',
skipMD5: true
},
autoStart: false
}
}

how to solve mongoParseError in nodeModule?

this is output after run yarn start having this is the error:
`yarn run v1.22.17
warning ../../../package.json: No license field
$ ts-node index.ts
MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
at new ConnectionString (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongodb-connection-string-url/src/index.ts:133:13)
at parseOptions (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/connection_string.ts:253:15)
at new MongoClient (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/node_modules/mongodb/src/mongo_client.ts:337:34)
at /Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:783:16
at new Promise (<anonymous>)
at NativeConnection.Connection.openUri (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/connection.js:780:19)
at Mongoose.createConnection (/Users/youmnasalloum/Desktop/ts/user/node_modules/mongoose/lib/index.js:285:10)
at Object.<anonymous> (/Users/youmnasalloum/Desktop/ts/user/db/index.ts:9:28)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Module.m._compile (/Users/youmnasalloum/Desktop/ts/user/node_modules/ts-node/src/index.ts:1455:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [start] Error 1`
this is package.json:
{ "name": "user", "version": "1.0.0", "main": "index.ts", "repository": "https://github.com/ArtistCrowdfundExchange/user", "author": "Oghogho Odemwingie", "license": "MIT", "devDependencies": { "#types/bcrypt": "^3.0.0", "#types/node": "^17.0.13", "typescript": "4.5.5" }, "scripts": { "start": "ts-node index.ts", "test": "echo no tests yet" }, "dependencies": { "#aws-sdk/client-s3": "^3.41.0", "#grpc/grpc-js": "^1.3.7", "amqp": "^0.2.7", "aws4": "^1.11.0", "bcrypt": "^5.0.0", "cuid": "^2.1.8", "encrypter": "^1.0.0", "erax.db": "^3.3.1", "jose": "3", "mongodb": "^4.5.0", "mongodb-uri": "^0.9.7", "mongoose": "6.1.8", "nanoid": "^3.1.29", "proto": "git+https://github.com/ArtistCrowdfundExchange/proto#playground", "ts-node": "^10.4.0", "winston": "^3.3.3", "yael-autoencrypt": "^1.1.0" } }
I tried to add packages mongo-Uri,mongo-connection-string-URI using yarn but still the same error when I do yarn start

Host React App with Parcel Build on gh pages?

Can someone please help me figure out how to host my app on gh pages. All I am getting when I deploy it is the ReadMe file.
My app is deployed using parcel build, and it works perfectly fine when ran locally.
This is my package.js:
{
"name": "myflix-client",
"version": "1.0.0",
"description": "",
"default": "src/index.html",
"dependencies": {
"#fortawesome/free-regular-svg-icons": "^5.15.4",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.16",
"axios": "^0.24.0",
"font-awesome": "^4.7.0",
"js-tokens": "^4.0.0",
"loose-envify": "^1.4.0",
"moment": "^2.29.1",
"object-assign": "^4.1.1",
"parcel": "^2.0.0-rc.0",
"parcel-bundler": "^1.12.5",
"prop-types": "^15.8.0",
"react": "^17.0.2",
"react-bootstrap": "^2.1.2",
"react-dom": "^17.0.2",
"react-paginate": "^8.1.0",
"react-redux": "^7.2.6",
"react-router-dom": "^5.2.0",
"redux": "^4.1.2",
"redux-devtools-extension": "^2.13.9",
"scheduler": "^0.20.2",
"uuid": "^8.3.2"
},
"scripts": {
"start": "parcel src/index.html",
"build": "parcel-build src/index.html",
"test": "echo \"Error: no test specified\" && exit 1",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/johannesvw3/myFlix-client-react.git"
},
"author": "Deepthi Rao",
"license": "ISC",
"bugs": {
"url": "https://github.com/johannesvw3/myFlix-client-react"
},
"homepage": "https://github.com/johannesvw3/myFlix-client-react",
"devDependencies": {
"#parcel/transformer-image": "^2.0.0-rc.0",
"#parcel/transformer-sass": "^2.0.0-rc.0",
"gh-pages": "^3.2.3"
}
}
Thanks!

ERROR #wdio/cli:utils: A service failed in the 'onPrepare' hook Error: Appium exited before timeout (exit code: 1) - Appium using emulator in VSCode

When trying to run I'm having the log below as ERROR #wdio/cli:utils: A service failed in the 'onPrepare' hook Error: Appium exited before timeout (exit code: 1)
package.json :
{
"name": "test2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/wdio wdio.conf.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#wdio/cli": "^7.3.1"
},
"devDependencies": {
"#wdio/appium-service": "^7.3.1",
"#wdio/local-runner": "^7.3.1",
"#wdio/mocha-framework": "^7.3.1",
"#wdio/spec-reporter": "^7.3.1",
"#wdio/sync": "^7.3.1",
"chromedriver": "^89.0.0",
"wdio-chromedriver-service": "^7.0.0"
}
}

facing error TS2339: Property 'then' does not exist on type 'StepDefinitions & Hooks'

facing error TS2339: Property 'then' does not exist on type 'StepDefinitions & Hooks'.
when I am trying to run tsc -w
tried all the solution which I know but nothing is working out.
Feature file:
Feature: Login creation for Amazon AWS
Scenario: Successful creation of Login
Given User navigate to Home Page
When User enter email and other details
Then Login is created sucessfully
Package.json
{
"name": "package.json",
"version": "1.0.0",
"description": "package",
"main": "index.js",
"dependencies": {
"#types/node": "^12.7.5"
},
"scripts": {
"test": "./node_modules/.bin/cucumber-js -p default"
},
"compilerOptions": {
"target": "es6"
},
"devDependencies": {
"#types/chai": "^4.2.2",
"#types/cucumber": "^4.0.7",
"chai": "^4.2.0",
"cucumber": "^5.1.0",
"cucumber-pretty": "^1.5.2",
"cucumber-tsflow": "^3.2.0",
"exceljs": "^2.0.1",
"protractor": "^5.4.2",
"protractor-cucumber-framework": "^6.1.3",
"ts-node": "^8.3.0",
"typescript": "^3.6.3",
"xlsx": "^0.15.1"
},
"author": "Bharani",
"license": "ISC"
}
Step Definition file:
import { Given, When, Then } from "cucumber"
Given("User navigate to Home Page", function(){
console.log("hafd");
});
When("User enter email and other details",function(){
console.log("dfhagsdf");
});
Then("Login is created sucessfully",function(){
console.log("dhfhd");
});
Package.json:
{
"name": "package.json",
"version": "1.0.0",
"description": "package",
"main": "index.js",
"dependencies": {
"#types/node": "^12.7.5"
},
"scripts": {
"test": "./node_modules/.bin/cucumber-js -p default"
},
"compilerOptions": {
"target": "es6"
},
"devDependencies": {
"#types/chai": "^4.2.2",
"#types/cucumber": "^4.0.7",
"chai": "^4.2.0",
"cucumber": "^5.1.0",
"cucumber-pretty": "^1.5.2",
"cucumber-tsflow": "^3.2.0",
"exceljs": "^2.0.1",
"protractor": "^5.4.2",
"protractor-cucumber-framework": "^6.1.3",
"ts-node": "^8.3.0",
"typescript": "^3.6.3",
"xlsx": "^0.15.1"
},
"author": "Bharani",
"license": "ISC"
}
Error in console:
'''[16:44:58] Starting compilation in watch mode...
POM_TS_CUCUMBER/Featurefile/stepdefinition/Steps.ts:3:32 - error
TS2339: Property 'then' does not exist on type 'StepDefinitions &
Hooks'.
3 defineSupportCode(({Given,When,then}) =>{
~~~~
[16:45:04] Found 1 error. Watching for file changes. '''
You have written Then in feature file which is not from the cucumber library. Try writing then statement again from cucumber library and try again.