Firebase Functions Cannot find name 'BigUint64Array', ''BigInt', ''BigInt64Array' - google-cloud-functions

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.

Related

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"

The react-scripts package provided by Create React App requires a dependency : Babel-Jest

I found this error message when running react-script test
The react-scripts package provided by Create React App requires a dependency "babel-jest": "^24.9.0"`
So the error message also recommend us to remove package-lock.json and also node_modules I tried but I have the same error message.
And I inspect the package-lock.json and for example jest-config (is a sub dependancies) use higher version than react-script accept.
Please if you have some advices
packages.json
{
"name": "creator-web-app",
"version": "0.1.0",
"private": true,
"main": "public/electron.js",
"homepage": "./",
"dependencies": {
"#craco/craco": "^5.6.4",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"#types/react": "^16.9.34",
"await-to-js": "^2.1.1",
"axios": "^0.19.2",
"classnames": "^2.2.6",
"electron-is-dev": "^1.2.0",
"env-cmd": "^10.1.0",
"enzyme": "^3.11.0",
"history": "^4.10.1",
"i18next": "^19.4.2",
"i18next-browser-languagedetector": "^4.0.2",
"jest": "^25.3.0",
"jwt-decode": "^2.2.0",
"moment": "^2.24.0",
"nano-id": "^1.1.0",
"npm-watch": "^0.6.0",
"react": "^16.13.1",
"react-cookies": "^0.1.1",
"react-dom": "^16.13.1",
"react-i18next": "^11.3.4",
"react-inlinesvg": "^1.2.0",
"react-redux": "^7.2.0",
"react-router-dom": "5.1.2",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"redux-form": "^8.3.3",
"redux-thunk": "^2.3.0",
"typescript": "^3.7.0"
},
"scripts": {
"electron": "NODE_ENV=production npm run build && NODE_ENV=production electron .",
"start": "NODE_ENV=development react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"pack": "NODE_ENV=production && npm run build && electron-builder --dir",
"dist": "NODE_ENV=production && npm run build electron-builder"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#types/classnames": "^2.2.10",
"#types/enzyme": "^3.10.5",
"#types/jest": "^25.2.1",
"#types/react-redux": "^7.1.7",
"#types/react-router-dom": "^5.1.4",
"#types/redux-form": "^8.2.3",
"craco-alias": "^2.1.1",
"electron": "^8.2.1",
"electron-builder": "^22.4.1",
"enzyme-adapter-react-16": "^1.15.2",
"node-sass": "^4.13.1",
"react-test-renderer": "^15.6.2",
"ts-jest": "^25.4.0",
"whatwg-fetch": "^3.0.0"
},
"build": {
"appId": "studioapp.id",
"mac": {
"category": "your.app.category.type"
},
"files": [
"**/*"
],
"directories": {
"buildResources": "."
},
"protocols": {
"name": "studioapp-protocol",
"schemes": [
"studioapp"
]
}
},
"jest": {
"collectCoverageFrom": [
"<rootDir>/src/**/*.{ts,tsx}"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|yml)$": "<rootDir>/tests/test-file-mock.js",
"\\.(css|less|scss|sss|styl)$": "<rootDir>/tests/test-mock.js",
"#/(.*)$": "<rootDir>/src/$1"
},
"transform": {
"^.+\\.(tsx|ts)?$": "ts-jest"
}
}
}
Thanks
I faced the same problem with create-react-app. Here is what I did
Go to the path
C:\Users\YOURNAME\node_modules
and then remove those packages which show an error.
More information here: https://github.com/creativetimofficial/argon-dashboard-react/issues/28
Ironically I was working on a similarish problem this morning. Could you provide a screenshot of your package.json and the error message?
Babel-Jest is used to compile javascript code into a format that jest can consume. I suspect that your problem is that you have a dependency that the lock file has subsequently locked in the incorrect version of babel-jest.
I can add some more details from the above response for solve this issue I found the problem.
When we use react-scripts we can't have jest packages or something is already manage by create-react-app
The problem when I have is package.json contain jest at superior version than react-script can accept
When I deleted this line in my package.json already seems to work
One of your dependencies is using a newer version of babel-jest. You can find which ones they are by running npm ls babel-jest in your project root directory.
A simple way to fix the problem then, is to try and link to an older version of those packages, e.g. "#types/jest": "^24.0.0" so that they don't use the newer version of babel-jest.
for mac user remove
/Users/{UserName}/node_modules

How can I run gulp on mac through terminal?

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

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

Error in deploy Cloud Functions .json not found

I can not deploy my functions when I try to import a .json credential file.
When running firebase init functions I selected the TypeScript
option.
Then I put my functions in TypeScript and tried loading the .json
file with the credentials of my project in order to use
firebase-admin.
/functions (Directory)
tsconfig.json
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6",
"types" : [ "node" ],
"esModuleInterop": true,
"resolveJsonModule": true,
},
"compileOnSave": true,
"include": [
"src",
"./typings.d.ts"
]
}
typings.d.ts:
declare module "*.json" {
const value: any;
export default value;
}
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"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "~6.0.0",
"firebase-functions": "^2.0.3"
},
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "~2.8.3"
},
"private": true
}
functions/src/
-- serviceAccountKey.json
-- index.ts
index.ts:
import * as admin from 'firebase-admin';
import * as serviceAccount from './serviceAccountKey.json';
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "DATABASE-URL"
});
If I remove the import works normally, I can not deploy when I import the file.
Error:
i deploying functions
Running command: npm --prefix "functions" run lint
> functions# lint Z:\functions
> tslint --project tsconfig.json
Running command: npm --prefix "functions" run build
> functions# build Z:\functions
> tsc
tsconfig.json(11,5): error TS5023: Unknown compiler option 'resolveJsonModule'.
+ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error parsing triggers: Cannot find module './serviceAccountKey.json'
Try running "npm install" in your functions directory before deploying.
You should use require() (not import) to pull in the contents of a JSON file. If you really must use import (I don't recommend it), read this.
If I remove the import works normally, I can not deploy when I import the file.
A few tsconfig options are missing:
"esModuleInterop": true,
"resolveJsonModule": true,