Error - git push heroku master - javascript

If you're attempting to help me, I really appreciate it.
So when I write git push heroku master, it fails to parse, and before you spit at me and say 'READ OTHERS!!!!' I have. I've rewritten the package.JSON and used a validator. The strange thing is it always says line 9, column 3, every time I reformat the package.JSON, always line 9, column 3. I have changed over 5-7 times. I don't think my package.json is necessary as it always brings that error.
But here it is anyway.
{
"name": "vulture",
"version": "1.0.1",
"description": "Vulture is a bot for discord.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": "8.4.0",
"npm": "5.4.0"
},
"author": "swagehsaan840#0336",
"license": "MIT"
}
A side note is changing it will probably give me the same error, but I never know, after using a validator and changing any times, it always says line 9, column 3.
Thanks anyway! :)

try to write this way package.json
{
"name": "vulture",
"version": "1.0.0",
"description": "vulture",
"main": "index.js",
"private": true,
"scripts": {
"start": "node index.js",
},
"author": "vulture",
"license": "ISC",
"dependencies": {
"node": "8.4.0",
"npm": "5.4.0"
}
}

add Buildpacks in heroku goto setting select add Buildpacks --> select nodejs

Related

Server running error in parcel by starting the external file index.html I Ignoring the main but it also doesn't work(Build Failed)

[Build Error in parcel # 2.7.0 start when I am trying to add external index.html file in the main I also ignored the main but it also doesn't work for me. Will please someone help me to solve this problem It also not working with JavaScript file when I added externally and also getting error with html file but I want to add the html file but as a solution I try to add JavaScript file but it also doesn't work for me. Will please someone solve this issue or tell me how to solve this issue
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"main": "unrelated.js",
"targets": {
"main": false
},
"scripts": {
"start": "parcel start index.html",
"build": "parcel build index.html"
},
"author": "Meelad Sultan",
"license": "ISC",
"devDependencies": {
"parcel": "^2.7.0"
}
}
enter code here
At last I can find the solution of my problem after almost a day if someone else facing the same problem they just do add the **Browsers list ** in the package.json file before script and ignore the main target and also set the parcel to latest then the parcel will run successfully and do not give any server error or build error. And don't forget to run periodically npx browerlist#latest --update-db. It will update your package-lock file with new caniuse-lite version. In this case, you will be sure that last two version or > 0.2% will target what you expect
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"main": "unrelated.js",
"target": {
"main": false
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"scripts": {
"start": "parcel index.html "
},
"author": "Meelad Sultan",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.7.0",
"parcel": "latest"
},
"dependencies": {
"sass": "^1.55.0"
}
}

I'm facing an error while trying to compile the code. Where am I going wrong and How do I fix it?

I'm getting the an error on terminal while trying to compile the code, but I don't understand why.
Code:
const express = require("express");
const app = express();
console.dir(app);
Error:
package.json:
{
"name": "firstapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.1",
"npm": "^8.15.0"
}
}
first, check that express is installed or not
if not run the following command
npm i express
also, check that you are using the latest version of the node
if all ok then run
node index.js
is still an issue not fixed submit your folder structure and package.json
so I can give you further assistance
Remove npm from dependency

Getting references error when importing tone.js

I have a basic express.js server setup on my Mac. To this I'm trying to import Tone.js, https://tonejs.github.io, by following the instructions.
npm install tone
To import Tone.js:
import * as Tone from 'tone'
But I'm getting this error
Uncaught TypeError: Failed to resolve module specifier "tone". Relative references must start with either "/", "./", or "../".
My Package file looks like this
{
"name": "XXXXX",
"version": "1.0.0",
"description": "Run npm start",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon start"
},
"repository": {
"type": "git",
"url": "git+https://github.com/xxxxx"
},
"author": "xxxxx xxxx",
"license": "ISC",
"bugs": {
"url": "https://github.com/xxxxxxx"
},
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12",
"tone": "^14.7.77"
}
}
As #lars-flieger pointed out, it's not possible to run it one a node.js server.
I ended up downloading Tones.js from here and includes it as a regular script tag.
https://github.com/Tonejs/Tone.js/wiki/Installation

Lite-server not working

I had a project that was previously using lite-server. I can no longer get it to run using
npm run
I see the following from the console
PS C:\Users\XXX\Documents\Work\Repos\Homepage_Slider> npm run
Lifecycle scripts included in homepage_slider: test
echo "Error: no test specified" && exit 1 start
lite-server
I don't really understand why this isn't working anymore.
I've tried:
Updating NPM
Running lite-server globably
Make sure package.json is set up correctly
Here is my package.json file
{
"name": "homepage_slider",
"version": "1.0.0",
"description": "A simple slider for homepage",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "lite-server"
},
"repository": {
"type": "git",
"url": "XXX"
},
"keywords": [
"Slider"
],
"author": "XXX",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.3.0"
},
"dependencies": {
"npm": "^6.0.1"
}
}
npm run is a reserved word for npm itself. Check the documentation
What you really need is npm start which is a shortcut for npm run start which is a shortcut for npm run-script start!

My node-sass npm script is not compiling

The structure of my project looks like this:
And my package.json looks like this:
{
"name": "personal_site",
"version": "1.0.0",
"description": "My personal website.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node-sass --output-style compressed ./dist/css/bundle.min.css ./src/scss/styles.scss",
"serve": ""
},
"author": "Dean Gibson",
"license": "ISC",
"dependencies": {
"bourbon": "^4.2.6",
"bourbon-neat": "^1.7.4"
},
"devDependencies": {
"node-sass": "^3.4.2"
}
}
But when I run npm build it looks like the terminal is "thinking" and it stops without throwing any errors. But nothing gets generated in dist/css/ ... Anything obvious that I'm doing wrong here?
UPDATE:
This is interesting, if I run that exact script directly from terminal then it works fine... Any ideas as to why?

Categories

Resources