How can I run gulp on mac through terminal? - json

I'm new to this! I am following a tutorial and we installed everything, and I want to run the gulp command but I can't.
This is the json package-
"name": "wlbs4",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.7",
"gulp": "^3.8.10",
"gulp-sass": "^4.0.2"
},
"dependencies": {
"bootstrap": "^4.4.1",
"jquery": "^3.4.1",
"popper.js": "^1.16.1"
This is my terminal command:
Noas-iMac:wlbs4 noahanan$ gulp
bash: gulp: command not found
What am I doing wrong? Thanks!
I tried to install globally but I think I don't have permission.
Thanks!!

If you want to run gulp globally (as you are doing in your question), you need to install gulp globally on your machine.
npm install -g gulp
You don't need to do this for the other dependencies in your project.
If you run into permissions issues, try:
sudo npm install -g gulp
However, take caution - it is not always considered 'good' practice to install Node Packages with Root level privelages.
This Stack Overflow answer should give you further guidance on the topic https://stackoverflow.com/a/24404451/2316753

Related

Downloading Sass with Node.js and the git Bash command line

I am having trouble downloading Sass in the command line.
I'm using Studio Code for my text editor. I need to know how to download it and add it to a website project.
This is what I have done so far in the command line
$ node --version
v17.8.0
$ npm --version
8.5.5
$ npm i sass
up to date, audited 18 packages in 2s
2 packages are looking for funding run 'npm fund' for details
found 0 vulnerabilities
$ npm start
sass-app#1.0.0 startsass./sass/index.scss./css/style.css
'sass.' is not recognized as an internal or external command, operable program or batch file.
Here is the json package file.
{
"name": "sass-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "sass./sass/index.scss./css/style.css"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {"sass": "^1.49.9"
}
}
You're missing spaces in your start script to separate the program name from the arguments.
"start": "sass./sass/index.scss./css/style.css"
should be
"start": "sass ./sass/index.scss ./css/style.css"

NPM commands return error: package.json must be actual JSON, not just JavaScript

... and I know that my json is perfectly valid json.
The problem started when I added some dev dependencies to the package.json, but it seems to be getting tripped up on the first lines. I've verified and cleaned the cache, updated npm, and I've combed through the file and the posts on this problem for a while, but cannot figure out what's going on. I've also tried some suggestions I saw on here, like changing all the " characters to ' characters. Nada.
My package.json is below, as well as the full error message when I run a command:
{
"name": "Outlook Beaty",
"version": "0.2.1",
"description": "A custom experience enhancer for Outlook.",
"repository": {
"type": "git",
"url": "https://github.com/team5-devs/js-outlook-plugin/"
},
"license": "MIT",
"config": {
"app-to-debug": "outlook",
"app-type-to-debug": "desktop",
"dev-server-port": 3000
},
"dependencies": {},
"devDependencies": {
"#babel/core": "^7.11.6",
"#babel/polyfill": "^7.11.5",
"#babel/preset-env": "^7.11.5",
"#types/find-process": "1.2.0",
"#types/office-js": "^1.0.108",
"#types/office-runtime": "^1.0.14",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.1.1",
"eslint": "^7.19.0",
"eslint-config-office-addins": "^1.0.19",
"find-process": "^1.4.3",
"file-loader": "^4.2.0",
"generator-office": "^1.7.8",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^4.5.0",
"jasmine": "^3.6.4",
"jsdoc": "^3.6.6",
"office-addin-cli": "^1.0.13",
"office-addin-debugging": "^3.0.34",
"office-addin-dev-certs": "^1.5.5",
"office-addin-lint": "^1.0.26",
"office-addin-manifest": "1.5.7",
"office-addin-prettier-config": "^1.0.12",
"source-map-loader": "^0.2.4",
"travis-ci": "^2.2.0",
"ts-loader": "^6.2.2",
"typescript": "^4.0.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
"yo": "^3.1.1"
},
"scripts": {
"build": "webpack -p --mode production --https false",
"build:dev": "webpack --mode development --https false",
"build-dev": "webpack --mode development --https false && echo . && echo . && echo . && echo Please use 'build:dev' instead of 'build-dev'.",
"dev-server": "webpack-dev-server --mode development",
"lint": "office-addin-lint check",
"lint:fix": "office-addin-lint fix",
"prettier": "office-addin-lint prettier",
"start": "office-addin-debugging start manifest.xml",
"start:desktop": "office-addin-debugging start manifest.xml desktop",
"start:web": "office-addin-debugging start manifest.xml web",
"stop": "office-addin-debugging stop manifest.xml",
"test": "jasmine",
"validate": "office-addin-manifest validate manifest.xml",
"watch": "webpack --mode development --watch"
}
}
npm install
npm ERR! JSON.parse "name": "Outlook Beaty",
npm ERR! JSON.parse "versio'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
Any help would be greatly appreciated!
P.S. I'm running Gitbash on Windows 10, but I tried to make sure that there are no Windows-specific characters. Maybe I'm mistaken.
the problem might be simpler than you overlooked?
I see on line (near yo dependency) you're missing a comma:
"webpack-dev-server": "^3.11.0"
"yo": "^3.1.1"
I suggest you add a comma, then try to run npm install again?
"webpack-dev-server": "^3.11.0",
"yo": "^3.1.1"

Firebase Functions Cannot find name 'BigUint64Array', ''BigInt', ''BigInt64Array'

Dependencies:
"dependencies": {
"cors": "^2.8.5",
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.11.0",
"nodemailer": "^6.4.11"
},
"devDependencies": {
"firebase-functions-test": "^0.1.6",
"tslint": "^5.12.0",
"typescript": "^3.2.2"
},
Description:
Since updating to firebase-functions 3.11.0, I get following error when trying to deploy my functions with firebase deploy --only functions:
node_modules/#types/jsdom/ts3.5/index.d.ts:8:24 - error TS2304: Cannot find name 'BigInt'.
8 BigInt: typeof BigInt;
~~~~~~
node_modules/#types/jsdom/ts3.5/index.d.ts:9:31 - error TS2304: Cannot find name 'BigInt64Array'.
9 BigInt64Array: typeof BigInt64Array;
~~~~~~~~~~~~~
node_modules/#types/jsdom/ts3.5/index.d.ts:10:32 - error TS2304: Cannot find name
'BigUint64Array'.
10 BigUint64Array: typeof BigUint64Array;
~~~~~~~~~~~~~~
Found 3 errors.
Even going back to the previous version doesn´t seem to solve the issue, so I´m not sure if the update was the trigger.
#edit 1 (full package.json)
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "10"
},
"main": "lib/index.js",
"dependencies": {
"cors": "^2.8.5",
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.11.0",
"nodemailer": "^6.4.11"
},
"devDependencies": {
"firebase-functions-test": "^0.1.6",
"tslint": "^5.12.0",
"typescript": "^3.2.2"
},
"private": true
}
I think I have it. From npm #types/jsdom I went to package homepage where I found this part.
It seems that you need to install additional package:
npm install --save-dev #types/node
I have replicated this issue with firebase init and replacing package.json with yours. I got the same issue than. After package install with above command my function was deployed with no errors.
One remark: you do not have #types/jsdom in package.json, which according to my understanding should be there. I have installed this package before replacing the file, to have similar situation.

i have install prisma but there is no specification of prisma in package.json

i have install prisma using
npm install -g prisma
but in my packaje.JSON file there is no such prisma configuration available ..what shoulkd i do?
package.json :
{
"name": "mysql-node",
"version": "1.0.0",
"description": "demo",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node db.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"#babel/core": "^7.0.0",
"apollo-server": "^2.5.0",
"apollo-server-express": "^2.5.0",
"axios": "^0.18.0",
"babel-preset-node5": "^12.0.1",
"express": "^4.16.4",
"graphql": "^14.3.0",
"graphql-tools": "^4.0.4",
"lodash": "^4.17.11",
"mysql": "^2.17.1",
"nodemailer": "^6.1.1",
"sequelize": "^5.8.7"
},
"devDependencies": {
"#babel/cli": "^7.0.0",
"#babel/core": "^7.4.5",
"#babel/node": "^7.4.5",
"#babel/preset-env": "^7.4.5"
}
}
TL;DR: run npm install prisma without the -g.
Explanations:
The command "npm install -g prisma" installs Prisma globally on your computer. This is useful so that you can run commands like prisma deploy directly in your terminal.
Installing Prisma as a dependency of your project (in package.json), will allow anyone cloning your project and running npm install to also download Prisma. However, you won't be able to access the command prisma deploy directly in your terminal, and you will need to put it in a script in package.json.
Eg:
{
...
scripts: {
"deploy": "prisma deploy"
}
...
}
And then npm run deploy
To install Prisma locally, simply run npm install prisma without the -g

how to update all package version number in package.json when use `npm update`?

when i use npm update , i can update all package , but package version number in package.json not change , in the package.json , have devDependencies and dependencies , like this :
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jquery": "^1.11.2"
},
"devDependencies": {
"lodash": "^2.4.1"
}
}
how to use one line command update all package and all package numbner in devDependencies and dependencies will update too.
One easy step:
$ npm i -g npm-check-updates && ncu -a && npm i
That is all. All of the package versions in package.json will be the latest.
From npm documentation:
When you want to update a package and save the new version as the
minimum required dependency in package.json, you can use:
npm update -S
or
npm update --save
Also As with all commands that install packages, the --dev flag will cause devDependencies to be processed as well. so your desired command is:
npm update --dev --save
Note that npm will only write an updated version to package.json if it installs a new package.
By typing these commands in terminal you can update to latest dependencies in package.json
npm i -g npm-check-updates
and go to your angular project with package.json and run:
ncu -u -a
it will update all of your dependencies to the latest.