npm script in package.json is not compiling css - npm-scripts

{
"name": "job_portal",
"version": "1.0.0",
"main": "index.js",
"devDependencies": {
"bulma": "^0.9.3",
"node-sass": "^6.0.1"
},
"scripts": {
"css-build": "node-sass --omit-source-map-url sass/mystyles.scss css/mystyles.css",
"css-watch": "npm run css-build -- --watch",
"start": "npm run css-watch"
},
"author": "",
"license": "ISC",
"description": ""
}
showing error:
An output directory must be specified when compiling a directory

Related

npm watch doesn't trigger browser-sync reloading

I'm trying to create an npm scripts configuration that compiles scss and uses browser-sync to reload the browser when files are written to the css directory.
The scss compilation works.
However, after the css is rewritten, browser-sync is not reloading the browser.
My package.json:
{
"name": "bob",
"version": "0.1.0",
"description": "testing",
"watch": {
"sass": {
"patterns": [
"./src/sass"
],
"extensions": "scss"
},
"bsReload": {
"patterns": [
"./src/css"
],
"extensions": "css"
}
},
"scripts": {
"dev": "concurrently \"npm run watch\" \"npm run bs\" ",
"bs": "browser-sync start --proxy \"http://mylocalsite.localdev\" ",
"bsReload": "browser-sync reload",
"watch": "npm-watch",
"serve": "http-server dist",
"sass": "sass --style=compressed ./src/sass/main.scss ./css/main.css"
},
"author": "Bob",
"license": "ISC",
"devDependencies": {
...
}
}

Is there anything that would be causing a SEGFAULT error in NPM due to my package.json?

I'm trying to figure out what is wrong with my package.json, does anyone have any ideas?
{
"name": "greeting",
"version": "1.0.0",
"description": "Testing Hello World",
"main": "hello.js",
"dependencies": {
"course-utilities": "^1.0.0",
"crashtravel-preprod-v2-utilities": "^1.0.0",
"jest": "^26.1.0"
},
"devDependencies": {},
"scripts": {
"test": "jest"
},
"author": "abel#mit.edu",
"license": "MIT",
"bugs": {
"url": "https://github.com/kogsio/greeting/issues"
},
"homepage": "https://github.com/kogsio/greeting#readme"
}

How to watch for changes to files in a folder using npm?

I'm trying to set up some form of auto-deployment using the npm package watch. Here is my package.json file:
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start -p 60000",
"watch:start": "watch \"npm run start\" ./build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
...
},
"devDependencies": {
"watch": "^1.0.2"
}
}
The app runs fine and it watches the correct folder, but when it detects a change, I get an infinite loop of EADDIRINUSE errors, because it is simply trying to re-run the app, not restart it.
How can I fix this?

npm ERR! missing script: start react project

I am not able to run my react project. The version of npm and node are as follows:
node -v
v10.12.0
npm -v
6.5.0
package.json
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1",
"web3": "^1.0.0-beta.37"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

devDependencies "module not found" error

I separated my dependencies between devDependencies and dependencies
{
"name": "contenttype",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.3.2",
"react-dom": "^15.3.2"
},
"scripts": {
"dev": "webpack-dev-server --content-base src --inline --hot"
},
"devDependencies": {
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"webpack": "^1.13.3"
}
}
As you can see I have an npm script, but when I run npm run dev, I get the error
webpack module not found
Why is that? The webpack module is in my devDependencies, so why isn't it being recongnized?
npm install webpack-dev-server --save-dev