I am just getting to learn node and webpack. I was following a tutorial, but I keep running into an error. Details of the error and my setup is given below:
error details
log file
My setup
package.json content
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"path": "^0.12.7"
}
}
Related
{
"name": "oculus_scraper_node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^1.0.0-rc.5",
"nodemailer": "^6.4.17",
"puppeteer": "^5.5.0"
}
}
When using heroku and checking if it deployed properly, I keep getting an error reading "npm ERR! missing script: start", but i definitely have the start script in my program, as you can see. I've looked through a couple other posts but nothing has worked. Any ideas?
I am trying to deploy a bot to run on Heroku servers. It fails to compile the app when I try to commit. Here is my package.json
{
"name": "Bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node bot.js"
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^12.0.2",
"dotenv": "^8.2.0"
}
}
bot.js is the correct name for the bot configuration file. It works fine when I take out start: node bot.js but the bot doesn't come online of course.
Try Changing main to bot.js.
https://devcenter.heroku.com/articles/deploying-nodejs
I added serve keyword inside package.json with localhost:8080 as it's value but it wont work. I tried using localhost ip address instead of "localhost" still got error.
On my package.json
{
"name": "package-lock",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"framework7": "^3.0.1"
},
"devDependencies": {},
"scripts": {
"serve":"localhost:8080",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
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"
}
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"
}
}