Using NPM for SCSS but the script will not watch for changes. It gives me a error - node.js

I have installed Node v12.10.0, NPM v6.10.3. I have also tried to install the node LTS version as well.
I built my project directory and inside the directory I ran "npm init" and after I ran "npm install --save-dev node-sass". Everything seems good up to this point.
my package.json file looks like this
{
"name": "dashboard",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"scss": "node-sass --watch scss -o css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.12.0"
}
}
After I go to run " npm run scss" then I receive this.
> dashboard#1.0.0 scss /Users/adakaitalker/Documents/school/dev/learning/2-september/4-week/9:13:19/dashboard
> node-sass --watch scss -o css
sh: node-sass: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! dashboard#1.0.0 scss: `node-sass --watch scss -o css`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the dashboard#1.0.0 scss script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adakaitalker/.npm/_logs/2019-09-13T22_43_56_711Z-debug.log

figured it out. I installed homebrew and linked it to node then I used homebrew to uninstall it and reinstall it and it works now.

Related

"run: not found" Error When Deploying MERN App to Heroku

I am trying to deploy my MERN web application to Heroku, but I have been getting this error:
remote: sh: 1: run: not found
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! syscall spawn
remote: npm ERR! file sh
remote: npm ERR! errno ENOENT
remote: npm ERR! reach-app#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install npm && run build`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the reach-app#1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
In terms of my structure, I have two directories in my root directory, called client and backend. Both of these directories each have their own package.json. I also initlialised git and another npm in the root directory. So, could it possibly be a problem with my file structure?
It doesn't seem like there are any other similar questions out there, so any help would be greatly appreciated. Thanks
EDIT:
This is my package.json in my root directory:
{
"name": "reach-app",
"version": "1.0.0",
"description": "Initialised npm for the root directory.",
"main": "index.js",
"scripts": {
"start": "node backend/server/index.js",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install && npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"example",
"heroku"
],
"author": "Phillip La",
"license": "ISC",
"engines": {
"node": "12.16.2"
}
}

"node server.js" works, but "npm start"cannot find node

Answers to similar questions here and here do not resolve my issue.
In an empty directory I create a file 'server.js' all it does is a console.log('hello'). Running this file with "node server.js" runs fine. But after "npm init -y" running through "npm start" gives:
npm start
The system cannot find the path specified.
> prj#1.0.0 start E:\projects\prj
> node server.js
/bin/bash: node: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! prj#1.0.0 start: `node server.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the prj#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
The detailed logfile reports correct versions of npm and node. And all of this is after an uninstall/reinstall of node.js.
Any hints on how to troubleshoot/fix appreciated.
project directory:
E:\prj
package.json
package-lock.json
server.js
package.json is the default after npm init:
{
"name": "prj",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}

Why does npm run build for babel throw an error: "babel: src does not exist"

My folder is src and I've installed babel via the CLI, yet I'm still getting an error, "babel:
src does not exist"
Here's a quick recording of of my code: https://drive.google.com/file/d/1YgEnJE87c0mEnsefY1xU94cvUedBtGhK/view
See above what I've tried.
{
"name": "notes-app",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src -d lib"
},
"author": "Jono Suave",
"license": "ISC",
"devDependencies": {
"#babel/cli": "^7.7.0",
"#babel/core": "^7.7.2"
}
}
app.js
import getNotes from "notes.js"
getNotes()
notes.js
let getNotes = function() {
console.log(`Put the time in baby!`)
}
module.exports = getNotes
I expected babel to run and compile my ES6 import code in app.js, but instead received following error in terminal:
babel:
src does not exist
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! notes-app#1.0.0 build: `babel src -d lib`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the notes-app#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jonosuave/.npm/_logs/2019-11-07T01_56_26_260Z-debug.log
In experimental node, Babel isn't even required -- just need to use a .mjs extension to files instead of .js
See explanation with example: How can I use an es6 import in node?

Can't install any npm packages

I can't install any npm packages. I type in npm install lodash and I get:
npm WARN webdev#1.0.0 No description
npm WARN webdev#1.0.0 No repository field.
npm ERR! path C:\Users\Blake\Desktop\webdev\node_modules\lodash
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Blake\Desktop\webdev\node_modules\lodash' -> 'C:\Users\Blake\Desktop\webdev\node_modules\.lodash.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Blake\AppData\Roaming\npm-cache\_logs\2018-03-15T21_28_45_978Z-debug.log
My package.json file looks like:
{
"name": "webdev",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
I'm not sure what is wrong. I've tried uninstalling and reinstalling node.js. My npm version is 5.6.0. This happens with every package I've tried to install. Please help, I've been trying to fix this for hours to no avail.
EDIT: I fixed it! The absolute nightmare of a program, MalwareBytes Antimalware was blocking it. I quit out of MalwareBytes and now it is working. Not the first time that program has messed up my coding.
Delete package.json and package-lock.json file, use npm init and try again.
Probably directory node_modules doesnt exist in your project working directory
I would make sure you have npm installed locally in your working directory by running npm init. I would also try re-installing npm.
EDIT:
Remove MalwareBytes Anti-Malware.

Use dependencies from a private GitLab with NPM

I'm trying to install NPM dependencies from a private GitLab instence.
So, I have my repo with basic files
And I added this dependencie in the package.json on my project
"node-demo-package": "https://oauth2:<ACCESS TOKEN>#gitlab.fullurl.git"
But, when I run npm install, I receive this error message:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: node-demo-package#https://oauth2:<ACCESS TOKEN>#gitlab.fullurl.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arnaud.delante/.npm/_logs/2018-01-24T15_05_49_456Z-debug.log
Which I don't understand as there is a package.json as showed in the screenshot.
Here it is
{
"name": "demo-package",
"version": "1.0.0",
"description": "Test pasckage",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git#gitlab.fullurl.git"
},
"author": "Arnaud Delante",
"license": "MIT"
}
I already tried switching https by git+https but I get another error
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t https://oauth2:<ACCES TOKEN>#gitlab.fullrul.git
npm ERR!
npm ERR! remote: You are not allowed to download code from this project.
npm ERR! fatal: unable to access 'https://oauth2:<ACCES TOKEN>#gitlab.fullrul.git': The requested URL returned error: 403
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arnaud.delante/.npm/_logs/2018-01-24T17_19_16_677Z-debug.log
Which is weird because the token is correct.
Would you have any idea?
In package.json try to replace https:// by git+https://
doc : https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

Resources