Error: "Package firebase-functions has been ignored because it contains invalid configuration" - only occurs on Mac M1, not on Windows - json

When I try to build my react native app in both android and ios on my Mac M1, I get this error.....it does not occur when I build on Windows:
Package firebase-functions has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/..../node_modules/firebase-functions/package.json
I took a look into my node modules folder, and at there is indeed a package.json file at the path node_modules/firebase-functions
Below is my package.json
"dependencies": {
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/push-notification-ios": "^1.10.1",
"#react-native-firebase/app": "^14.5.1",
"#react-native-firebase/auth": "^14.5.1",
"#react-native-firebase/database": "^14.5.1",
"#react-native-firebase/storage": "^14.5.1",
"#react-native-google-signin/google-signin": "^7.2.2",
"#react-native-picker/picker": "^2.3.1",
"#sentry/react-native": "^3.3.0",
"firebase-functions": "^3.20.1",
"flow": "^0.2.3",
"flow-bin": "^0.173.0",
"prop-types": "^15.8.1",
"react": "17.0.2",
"react-native": "0.67.0",
"react-native-background-timer": "^2.4.1",
"react-native-crypto-js": "^1.0.0",
"react-native-elements": "^3.4.2",
"react-native-fbsdk": "^3.0.0",
"react-native-form-validator": "^0.5.1",
"react-native-fs": "^2.19.0",
"react-native-gesture-handler": "^2.3.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-google-places-autocomplete": "^2.4.1",
"react-native-image-crop-picker": "^0.37.3",
"react-native-maps": "^0.30.1",
"react-native-permissions": "^3.3.0",
"react-native-phone-number-input": "^2.1.0",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^1.13.4",
"react-native-safe-area-context": "^4.1.2",
"react-native-screens": "^3.13.1",
"react-native-sound": "^0.11.2",
"react-native-switch": "^1.5.1",
"react-native-vector-icons": "^9.1.0",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.2",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"symbol-observable": "^4.0.0",
"twitter-lite": "^1.1.0"
},

When handling node packages please ensure the following steps:
Remove package-lock.json - if this file originated using a different OS there is a chance that some dependencies are installed with wrong configuration
Manually remove node_modules folder - in order to remove current setup (it may include wrong installation of several modules)
Reinstall using npm install - this should re-create package-lock.json file as well as relevant deendencies for current OS
My personal tip: add package-lock.json to git.ignore file in order to prevent wrong setup when project moves from one developer (using some OS) to a different developer (which may use a different OS)

Related

How to fix: Error while executing ssh://git#github.com/ethereumjs/ethereumjs-abi.git

I am working with Material UI and React and while on my Windows and Ubuntu the app runs ok, on my colleagues Mac and Ubuntu the compiler gives this error:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/ethereumjs/ethereumjs-abi.git
The only dependency I thought it was related to was ethereumjs which I removed because actually it wasn't needed, but the problem persists.
These are the dependencies:
"dependencies": {
"#emotion/react": "^11.4.0",
"#emotion/styled": "^11.3.0",
"#ethersproject/providers": "^5.4.1",
"#material-ui/core": "^5.0.0-beta.0",
"#material-ui/icons": "^5.0.0-beta.0",
"#material-ui/styled-engine-sc": "^5.0.0-beta.0",
"#material-ui/styles": "^4.11.4",
"#testing-library/jest-dom": "^5.12.0",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"#walletconnect/web3-provider": "^1.4.1",
"#web3-react/core": "^6.1.9",
"#web3-react/injected-connector": "^6.0.7",
"flag-icon-css": "^3.5.0",
"i18next": "^20.3.1",
"i18next-browser-languagedetector": "^6.1.1",
"i18next-http-backend": "^1.2.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.10.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-stepper-horizontal": "^1.0.11",
"styled-components": "^5.3.0",
"web-vitals": "^1.1.2",
"web3": "^1.3.6"
},
Any idea why this happens?
This could be due to ethereumjs-abi dependency which needs to be downloaded in ssh mode where the repo is cloned using https.
As a fix, Adding github identity with ssh-add solves the issue.
ssh-add -K <path to private key>
$ ssh-add -K ~/.ssh/github
Identity added: /Users/abc/.ssh/github

gulp-eslint Environment key "es2021" is unknown

I have a project with the following dependencies;
"dependencies": {
"express": "^4.17.1"
},
"devDependencies": {
"browser-sync": "^2.26.13",
"del": "^6.0.0",
"eslint": "^7.16.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"gulp": "^4.0.2",
"gulp-cssmin": "^0.2.0",
"gulp-eslint": "^6.0.0",
"gulp-htmllint": "0.0.19",
"gulp-htmlmin": "^5.0.1",
"gulp-imagemin": "^7.1.0",
"gulp-jsmin": "^0.1.5"
When I try to run a gulp task that lints javascript, using eslint/gulp-eslint;
function javascript() {
return src('private/script/**')
//.pipe(jsmin())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(dest('public/script'));
}
I get the following error;
Error: .eslintrc.json ยป eslint-config-standard:
Environment key "es2021" is unknown
I used npx eslint --init to generate the following configuration file;
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": [
"standard"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}
i have done an npm install, to make sure I have the latest version of the dependencies. I have also read on guthub that the error might have something to do with gulp-eslint as it is an old version and might not be using the current version of eslint, however, in I have changed gulp-eslint package.json to use the latest version of eslint and no luck. I also updated node/npm to their latest lts versions.
I fixed this by deleting the eslint folder in the node_modules folder for gulp-eslint. this forces node to use the version you have as a dependency rather than the version the project maintainer wants to use.
it appears this is a known issue.
I solve it by upgrading eslint version to version 7
This is what my package json looks like
The problem is that gulp-eslint works with ESLint 6 under the hub, and ESLint 6 does not support the es2021 environment (see the supported environments of ESLint 6).
I'm going to show three options to handle this. The best solution will depend on your setup and requirements.
Method 1: Replace es2021 with an equivalent definition
The es2021 environment is the same as es2020 with the addition of the globals AggregateError, FinalizationRegistry and WeakRef (see the definition of es2021), so you could enter these settings in your .eslintrc configuration file instead to obtain the same result.
{
...
"env": {
...
"es2020": true
},
...
"globals": {
...
"AggregateError": "readonly",
"FinalizationRegistry": "readonly",
"WeakRef": "readonly"
},
...
}
Method 2: Force gulp-eslint to use ESLint 7
If you are using npm >= 8.3 < 9.0 (check this with npm -v), you can override the version of ESLint used by gulp-eslint.
To do so, first add an override entry to your package.json file like this:
{
...
"overrides": {
"gulp-eslint": {
"eslint": "7"
}
},
...
}
then run:
npm install
Now, gulp-eslint will work with the latest version of ESLint 7 which does recognize the es2021 environment (it exists in ESLint >= 7.8).
Note that gulp-eslint does still not support ESLint 7, so some things may not work as expected. Particularly, some plugins may fail to load or produce runtime errors.
Method 3: Use gulp-eslint-new
gulp-eslint-new works with ESLint 8 and can be used in most situations as a drop-in replacement for gulp-eslint, provided that the configuration is compatible with both versions.
Uninstall gulp-eslint with
npm uninstall gulp-eslint
Install gulp-eslint-new with
npm install -D gulp-eslint-new
In your gulpfile, replace the import of gulp-eslint with gulp-eslint-new.
DISCLAIMER: I am currently the only maintainer of gulp-eslint-new.

How can I compile new Set() of ES 6 into ES 5 grammar using Babel?

I am compiling with Babel for the development of Google App Script.
Because Google App Script does not correspond ES6 grammar.
I like the ES6 set type, so I tried using ES6's new Set () , but it does not transpile and it is left as it is.
How can I transfer to ES5?
The package.json is as follows.
"devDependencies": {
"babel-core": "^6.26.3",
"babel-plugin-transform-es5-property-mutators": "^6.24.1",
"babel-preset-env": "^1.7.0",
"child_process": "^1.0.2",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-googleappsscript": "^1.0.1",
"eslint-plugin-import": "^2.12.0",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1"
}
Set is polyfillable. Features that can be polyfilled aren't transpiled.
core-js, babel-polyfill (it uses core-js internally) or any other ES6 polyfill can be used for this purpose.

Unable to run npm install successfully due to karma: none was installed

I have package.json file in which following devDependencies are mentioned:
{ "name": "tabs-torico",
"version": "1.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-angular-templates": "~0.5.1",
"grunt-autoprefixer": "~0.4.0",
"grunt-cli": "~0.1.11",
"grunt-concurrent": "~0.4.1",
"grunt-connect-proxy": "~0.1.7",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "^0.5.3",
"grunt-karma": "~0.6.2",
"grunt-newer": "~0.5.4",
"grunt-ngmin": "~0.0.2",
"grunt-protractor-runner": "~0.2.1",
"grunt-rev": "~0.1.0",
"grunt-usemin": "~2.0.0",
"jasmine-core": "^2.6.2",
"jshint-stylish": "~0.1.3",
"karma": "^0.10.10",
"karma-chrome-launcher": "^0.1.12",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "^0.1.6",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-ng-scenario": "~0.1.0",
"karma-requirejs": "~0.2.1",
"karma-script-launcher": "~0.1.0",
"load-grunt-tasks": "~0.2.0",
"phantomjs": "^2.1.7",
"phantomjs-prebuilt": "^2.1.14",
"protractor": "~0.18.1",
"requirejs": "~2.1.10",
"time-grunt": "~0.2.1"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}
Now when I run npm install gives me the following error:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
fsevents#github:pipobscure/fseve
nts#7dcdf9fa3f8956610fd6f69f72c67bace2de7138
(node_modules\chokidar\node_modules
\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#
0.2.1: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"}
)
npm WARN karma#0.10.10 requires a peer of karma-coffee-preprocessor#~0.1.0
but none was installed.
npm WARN karma#0.10.10 requires a peer of karma-firefox-launcher#~0.1.0 but
none was installed.
npm WARN karma#0.10.10 requires a peer of karma-phantomjs-launcher#~0.1.0
but none was installed.
Will running npm install install all the dependencies mentioned in the package.json or do I need to install jasmine-core and karma-jasmine separately?
npm install installs all the dependencies specified in your package.json. You should find the in your node_modules folder.
It's the problem with your version of karma.
In the package.json file includes the following line instead of the current line of karma.
"karma": "^0.11.14"
Also, it is important to note that if you are using karma-chrome-launcher
you need to include that as well in your package.json file as the new version of karma doesn't come with it.
So include the following line as well.
"karma-chrome-launcher": "^0.1.2"
I hope this will solve your problem.

Babel transpiling es7 class decorators Unexpected token error

im working on an Aurelia app that used es6 and es7 code, im trying to transpile the code using babel. I have the following in my packages.json file
"scripts": {
"babel": "babel --stage 1 -d AureliaWeb/ ../Test/Aurelia/ --extends babelrc",
I have the following packages installed:
"devDependencies": {
"babel-core": "^6.10.4",
"babel-plugin-syntax-decorators": "^6.8.0",
"babel-plugin-syntax-flow": "^6.8.0",
"babel-plugin-transform-es2015-modules-amd": "^6.8.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.10.3",
"babel-plugin-transform-es2015-modules-systemjs": "^6.9.0",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"babel-preset-stage-2": "^6.11.0",
"babel-preset-stage-3": "^6.11.0",
"babel-register": "^6.9.0",
"chai": "^3.5.0"
},
"dependencies": {
"babel-plugin-transform-class-properties": "^6.10.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015-loose": "^7.0.0",
"core-js": "^2.4.0",
"lodash": "^4.13.1"
}
Im trying to transpile es7 code looking like:
import {inject, noView} from 'aurelia-framework';
import {HttpClient} from 'aurelia-http-client';
#noView() <-- THIS IS CAUSING THE ERROR!!
#inject(HttpClient)
export class CompanyDataManager {
Im getting the error Syntax error Unexpected token arount the class decorator #noView. I have checked the stage 1 preset and i know that class decorators have been removed http://babeljs.io/docs/plugins/preset-stage-1/
Due to this I have added in the legacy decorator 'babel-plugin-transform-decorators-legacy found here 'https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy
so my .babelrc (which is located at the root of my project) looks like so:
{
"presets": [ "es2015-loose", "stage-1" ],
"plugins": [
"syntax-decorators",
"syntax-flow",
"babel-plugin-transform-decorators-legacy",
"transform-class-properties",
"transform-flow-strip-types"
]
}
However im still finding no joy! Question is
How can i confirm that my babelrc file is being picked up when im executing the babel script in npm? I tried adding --extends babelrc in an attempt to force it, but im not sure if this is correct.
I have also tried specifying a plugin in the babel command like so:
"babel --plugins babel-plugin-transform-decorators-legacy --stage 1 -d AureliaWeb/ ../Test/Aurelia/"
Still no luck, any help would be greatly appreciated.
Update 1
After messing around with the .bablerc file, i think i might have placed it in the wrong location. My structure is as follows (its an mvc app).
Test.UnitTest (Project) <-- i am running the babel script from here
AureliaWeb <-- end trandpiled location
Test (Project)
Aurelia <-- contains actual Aurelia code
After having moved the .bablerc file into Test > Aurelia I started getting the following error
Unknown plugin "transform-decorators-legacy" specified in "C:\Code\src\Test\Aurelia\.babelrc" at 0, attempted to resolve relative to "C:\Code\src\Test\Aurelia"
I have tried installing the package for transform-decorators-legacy in both projects to see if it makes any difference
Update 2
I can now confirm that this was in fact the issue, it appears that the babel file needs to be placed in the source folder, not destination or the location from which babel has been executed.
I believe you just need to remove the parentheses:
#noView
#inject(HttpClient)
export class CompanyDataManager {
See, for example, point 2 under "Best Effort":
class Example {
#dec
static prop = i++;
}
______
Note: when you declare a babel plugin in your .babelrc (or package.json) you can drop the prefix babel-plugin-:
[
"syntax-decorators",
"syntax-flow",
"transform-decorators-legacy",
"transform-class-properties",
"transform-flow-strip-types"
]
______
How can i confirm that my babelrc file is being picked up when im executing the babel script
Babel looks in the directory in which it was invoked for either a .babelrc or package.json with "babel" property. So long as you have either of these and are executing Babel in the same directory, Babel will find it.
I have answered my own question, details are in the main post.
The babel file needs to be placed in the source folder, not destination or the location from which babel has been executed.