My node-sass npm script is not compiling - javascript

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?

Related

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!

Error - git push heroku master

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

How to set npm run dev as starter for your app?

I am working with React and I am trying to figure out how to set npm run dev in order to compile and put my app to work. Right now, I need to do this in the terminal in order to see my app running
$ node server/index.js
here is the way I have my folders
and here is what I have in package.json
{
"name": "iOS.server2x.socket",
"version": "0.0.1",
"description": "iOS Live Socket.",
"author": "iOS Interactive",
"main": "server/index.js",
"port": 1101,
"scripts": {
"pretest": "eslint ./server",
"test": "echo \"Error: no test specified\" && exit 0",
"start": "rm -rf /home/git/.forever/chat.log; forever start --uid 'chat' ./server/index.js",
"stop": "forever stop chat"
},
"repository": {
"type": "xxxxxx",
"url": "http://url/url"
},
"dependencies": {
"async": "^1.4.2",
"babel": "5.8.3",
},
"devDependencies": {
"babel-eslint": "4.0.5",
}
}
And also, should I need webpack for this ?
I will answer my own question:
there is a way to set this actually, all I did is in the package.json in the scripts part
"scripts": {
"dev": "nodemon ./server/index.js",
"pretest": "eslint ./server",
"test": "echo \"Error: no test specified\" && exit 0",
"start": "rm -rf /home/git/.forever/chat.log; forever start --uid 'chat' ./server/index.js",
"stop": "forever stop chat"
}
so, npm run <here something in that json>, like
$ npm run dev in order to start the server
$ npm run pretest this is the task to run eslint
and so on . . .

Categories

Resources