Parse error: Expected another key-value pair - node.js

I'm trying to host a bot for Discord in Heroku, but when doing git push heroku master it gives me this error:
Node.js app detected
remote: parse error: Expected another key-value pair at line 41, column 1
remote: ! Unable to parse package.json
remote:
remote:
remote: -----> Build failed
remote: parse error: Expected another key-value pair at line 41, column 1
remote: parse error: Expected another key-value pair at line 41, column 1
remote: parse error: Expected another key-value pair at line 41, column 1
This is the content of the package.json file
{
"name": "sebas",
"version": "0.0.5",
"description": "un bot cualquiera",
"main": "index.js",
"engines": {
"node": "8.x",
"npm": "*"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/synicalsyntax/discord.js-heroku.git"
},
"keywords": [
"heroku",
"discord.js"
],
"author": "miguerubsk",
"license": "ISC",
"homepage": "https://github.com/synicalsyntax/discord.js-heroku#readme",
"dependencies": {
"bufferutil": "^3.0.3",
"discord.io": "^2.5.3",
"discord.js": "^11.3.2",
"ffmpeg": "0.0.4",
"ffmpeg-binaries": "^3.2.2",
"node-gyp": "^3.6.2",
"opusscript": "0.0.6",
"uws": "^9.14.0",
"winser": "^1.0.3",
"ytdl-core": "^0.20.2"
},
"devDependencies": {},
"bugs": {
"url": "https://github.com/synicalsyntax/discord.js-heroku/issues"
},
}

You simply needed to remove the comma at the end, as Chris said. This should be the code:
{
"name": "sebas",
"version": "0.0.5",
"description": "un bot cualquiera",
"main": "index.js",
"engines": {
"node": "8.x",
"npm": "*"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/synicalsyntax/discord.js-heroku.git"
},
"keywords": [
"heroku",
"discord.js"
],
"author": "miguerubsk",
"license": "ISC",
"homepage": "https://github.com/synicalsyntax/discord.js-heroku#readme",
"dependencies": {
"bufferutil": "^3.0.3",
"discord.io": "^2.5.3",
"discord.js": "^11.3.2",
"ffmpeg": "0.0.4",
"ffmpeg-binaries": "^3.2.2",
"node-gyp": "^3.6.2",
"opusscript": "0.0.6",
"uws": "^9.14.0",
"winser": "^1.0.3",
"ytdl-core": "^0.20.2"
},
"devDependencies": {},
"bugs": {
"url": "https://github.com/synicalsyntax/discord.js-heroku/issues"
}
}

Related

Can't deploy Node.js project to Vercel - 404: NOT_FOUND

I added valid Environment Variables (PORT and Database URI) to Vercel.
When searching I found that whole project must be wrapped in "api" folder so i did it.
This is my configuration. I added everything I found. Am I missing something or i added something wrong?.
vercel.json
{
"version": 2,
"builds": [
{
"src": "./api/index.ts",
"use": "#vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "./api/index.ts"
}
]
}
package.json
{
"name": "back-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon api/index.ts"
},
"engines": {
"node": "16.x"
},
"author": "",
"license": "ISC",
"devDependencies": {
"#types/express": "^4.17.16",
"#types/mongoose": "^5.11.97",
"#types/node": "^18.11.18",
"#types/nodemon": "^1.19.2",
"nodemon": "^2.0.20",
"typescript": "^4.9.5"
},
"dependencies": {
"body-parser": "^1.20.1",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"mongoose": "^6.9.1"
}
}
Vercel 404 Page`
I tried to deploy my app on vercel

Parcel keeps throwing invalid parcel config or zsh:segmentation fault - build fails

I set up parcel with the newest version and upon following the terminal command: parcel src/index.html, I get an invalid parcel config error. Whenever I use the command npx parcel src/index.html, I get a zsh: segmentation fault. No matter what, I cannot seem to build the app although the dependencies are set up.
Tried deleting node_modules and npm install but no success.
Can anyone point me in the right direction please?
Package.json:
{
"name": "movie-central-client",
"source": "src/index.html",
"version": "1.0.0",
"description": "",
"default": "src/index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel",
"build": "parcel build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/...git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/.../issues"
},
"homepage": "https://github.com/...",
"dependencies": {
"axios": "^0.27.2",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"#babel/cli": "^7.18.6",
"#babel/core": "^7.18.6",
"#babel/preset-env": "^7.18.6",
"#parcel/transformer-sass": "^2.0.0-rc.0",
"nodemon": "^1.3.3",
"parcel": "^2.6.2"
}
}
Terminal error:
#parcel/core: Invalid Parcel Config
node_modules/#parcel/config-default/index.json:149:2
148 | },
> 149 | "compressors": {
> | ^^^^^^^^^^^^^ Possible values: "extends", "validators", "filePath", "resolveFrom"
150 | "*": [
151 | "#parcel/compressor-raw"

Getting error : when set debugger in Nightwatchjs

Hi everyone I want to set debugger in my Nightwatchjs project But I got one error
my package.json
{
"name": "intro-to-nightwatchjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"debug": "node --inspect-brk node_modules/.bin/nightwatch",
"test": "nightwatch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chromedriver": "^80.0.1",
"eslint": "^6.8.0",
"minimist": "^1.2.5",
"nightwatch": "^1.3.4",
"optimist": "^0.6.1"
}
}

Update Packages.json automatically with the pre-installed moduels in NODEJS

In my local machine, I worked on a node.js app, I had installed many packages before initializing the package.json.
When I initialized the Package.json using:
npm init
I got the package.json but it does not contain all the dependencies that exist in the node_modules,
Which caused me a problem of missing packages when I moved to the production server (I run npm install)
Is there a way to automatically include all of them in the dependencies part.
Here is the JSON file I have:
{
"name": "xxxx",
"version": "1.0.0",
"description": "xxxxxxx",
"main": "server.js",
"dependencies": {
"date-utils": "^1.2.21",
"mssql": "^4.0.4",
"mysql": "^2.11.1",
"seriate": "^0.9.0",
"websocket": "^1.0.23",
"winston": "^2.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/odot-web/hefner-socket.git"
},
"keywords": [
"nodejs",
"hefner",
"socket"
],
"author": "xxxx",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/odot-web/hefner-socket/issues"
},
"homepage": "https://gitlab.com/odot-web/hefner-socket#README"
}

heroku error: Expected another key-value pair

I am trying to deploy a nodejs app to heroku for the first time, following heroku's instructions here
When I run git push heroku master, it starts compiling the app, but when it reaches 100% and I get this
parse error: Expected another key-value pair at line 18, column 1
! Push rejected, failed to compile Node.js app
To git#heroku.com:agile-sands-7020.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:agile-sands-7020.git'
I have created new keys with ssh-keygen -t rsa
and added them to heroku with heroku keys:add but I still get this error. Can someone help me please?
Ah, I figured it out, this mysterious error has to do with the package.json file. Basically I botched the "engines" field by declaring it in a seperate json object
{
"name": "elegant-insults",
"version": "0.0.0",
"description": "Insult eachother in the most elegant of ways",
"main": "server.js",
"dependencies": {
"socket.io": "~0.9.16",
"xml2js": "~0.4.1",
"express": "~3.4.8"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "roman-sharf",
"license": "ISC",
"repository": {
"type": "git",
"url": "git#heroku.com:elegant-insults.git"
}
},
{
"engines": {
"node": "0.10.x"
}
}
instead it should be like this:
{
"name": "elegant-insults",
"version": "0.0.0",
"description": "Insult eachother in the most elegant of ways",
"main": "server.js",
"dependencies": {
"socket.io": "~0.9.16",
"xml2js": "~0.4.1",
"express": "~3.4.8"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "roman-sharf",
"license": "ISC",
"engines": {
"node": "0.10.x"
},
"repository": {
"type": "git",
"url": "git#heroku.com:elegant-insults.git"
}
}

Resources