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

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.

Related

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

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)

Error in WDIO Chai/ Cucumber testsuite after updating chromedriver: #wdio/runner: TypeError: hooks.map is not a function at Obj.executeHooksWithArgs

I'm working on Wdio-Chai-Cucumber based e2e-testsuite that ran fine untill I had to update the chromedriver.
This is my stack:
"devDependencies": {
"#types/chai": "^4.2.13",
"#types/cucumber": "^6.0.1",
"#types/node": "^14.11.8",
"#types/webdriverio": "^5.0.0",
"#wdio/cli": "6.6.2",
"#wdio/cucumber-framework": "^6.10.6",
"#wdio/local-runner": "6.6.2",
"#wdio/spec-reporter": "6.8.1",
"#wdio/sync": "6.10.4",
"chai": "^4.2.0",
"chromedriver": "90.0.1",
"cucumber": "^7.0.0-rc.0",
"cucumber-html-reporter": "5.2.0",
"del-cli": "^3.0.1",
"eslint": "^7.10.0",
"wdio-chromedriver-service": "^7.1.0",
"wdio-cucumber-parallel-execution": "^3.6.14",
"wdio-cucumberjs-json-reporter": "2.0.2",
"wdio-docker-service": "^3.1.2"
},
"dependencies": {
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
},
After updating the projects chromedriver from v90 to v98 I get the following error when I run "yarn run test"
#wdio/runner: TypeError: hooks.map is not a function at Object.executeHooksWithArgs
There is a log-message indicating that both cucumber#6.0.5 and cucumber#7.0.0-rc.0 have moved to #cucumber/cucumber, so I tried
yarn remove cucumber
yarn remove #types/cucumber
yarn add -D #cucumber/cucumber
But I still get the same error message when trying to run the test, like nothing has changed. What am I doing wrong?

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

Can't compile assets with Gulp

Every tutorial or doc I find says that I should do something like this:
var elixir = require('laravel-elixir');
elixir.config.assetsPath = 'themes/ei/assets/src';
elixir.config.publicPath = 'themes/ei/assets/'
elixir(function(mix) {
mix.sass('style.scss');
mix.scripts('main.js');
});
But when I run gulp from the command line I get:
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/home/andrew/Development/eiweb/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/home/andrew/Development/eiweb/node_modules/undertaker/lib/task.js:13:8)
at Object.<anonymous> (/home/andrew/Development/eiweb/node_modules/laravel-elixir/dist/tasks/recipes/default.js:30:6)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at requireDir (/home/andrew/Development/eiweb/node_modules/require-dir/index.js:123:33)
My package.json file includes:
"dependencies": {
"gulp": "^4.0.2",
"laravel-elixir": "^6.0.0-18"
}
...and I have gulp-cli installed global.
What am I missing?
This issue occurs because of version issue gulp 4 has different signature for the task and laravel-elixir uses old signature of gulp 3 so it will cause error.
Best case would be to move https://laravel-mix.com as its based on webpack so it support more functionalities. also laravel-mix syntax is similar so its plus point.
For laravel-mix create this pacjage package.json file in root. or user latest from [ https://github.com/laravel/laravel ] public repo.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.1.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
"sass-loader": "^7.1.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
Create webpack.mix.js in your root
const mix = require('laravel-mix');
// change theme path according to your need.
const themePath = 'themes/rainlab-bonjour';
mix.options({
publicPath: themePath + '/assets/compiled/'
})
// change script name and path according to your need.
mix.js(themePath + '/assets/src/main.js', 'main.js')
.sass(themePath + '/assets/src/main.scss', 'main.css');
Commands [ you can use this command with yarn or npm (I am using yarn)], you can read more info here. [ https://laravel-mix.com/docs/4.0/workflow ]
yarn watch -> it will watch files and compile files then generate compiled out-put in publicPath directory. in our case files will be.
themes/rainlab-bonjour/assets/compiled/main.js
themes/rainlab-bonjour/assets/compiled/main.css
Now you can just include them in theme using 'assets/compiled/main.js'|theme OctoberCms filter.
if you have any doubts please comment.

at=error code=H10 desc="App crashed" method=GET path="/" Error Deploying React/Node to Heroku

I'm trying to deploy a React on Node project I was working on and am running into some issues and I'm not certain why. Below is some information pulled from the log:
2018-02-11T00:12:22.875338+00:00 app[web.1]: > dmdb#1.0.0 start /app
2018-02-11T00:12:22.875340+00:00 app[web.1]: > node server.js
2018-02-11T00:12:22.875341+00:00 app[web.1]:
2018-02-11T00:12:23.315310+00:00 heroku[web.1]: State changed from starting to crashed
2018-02-11T00:12:23.299113+00:00 heroku[web.1]: Process exited with status 1
2018-02-11T00:13:23.976931+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dmdb1.herokuapp.com request_id=8d37e10b-6999-4a2f-82bb-f3e724bf1c4e fwd="108.14.98.161" dyno= connect= service= status=503 bytes= protocol=https
Based on what the log shows, it seems like there's an issue with the start script in my package.json file, but I'm not sure why since I've used a similar one for another project I've deployed successfully. I did some research on this and I believe my Server.js file is configured and the ports are set up properly, I removed devdependencies and confirmed it works locally but not deployed, and I've got my SECRET_KEY set up in the vars since this has auth set up. Below is how I have my ports set up, and what my package.json file looks like on the backend. If anybody could please provide some insight I'd greatly appreciate it. If there's any additional information I can provide please let me know and I'll do so ASAP.
Ports from Server.js:
//app listening on port 1337
const PORT = process.env.PORT || 1337;
app.listen(PORT, () => {
console.log(`LISTENING ON PORT ${PORT}`)
})
Updated Package.json from Backside:
{
"name": "dmdb",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"dev": "nodemon server.js",
"debugger": "DEBUG=*:* nodemon server.js",
"prod": "NODE_ENV=production node server.js",
"deploy": "cd client && yarn build && cp -a ./build/ ../public/",
"heroku-postbuid" : "cross-env NODE_ENV=production WEBPACK_CONFIG=browser_prod,server_prod webpack --colors",
},
"engines": {
"node": "8.5.0",
"yarn": "1.3.2"
},
"author": "Dan Levenson",
"license": "MIT",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"dotenv": "^4.0.0",
"ejs": "^2.5.7",
"ejs-lint": "^0.3.0",
"express": "^4.16.2",
"express-session": "^1.15.6",
"isomorphic-fetch": "^2.2.1",
"method-override": "^2.3.10",
"morgan": "^1.9.0",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"pg-promise": "^7.0.3"
}
}
Thanks in advance!
Editing post to include Package.JSON from client:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.0",
"reactstrap": "^5.0.0-beta"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3001"
}
Adding Build Log:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 8.5.0
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): 1.3.2
Resolving node version 8.5.0...
Downloading and installing node 8.5.0...
Using default npm version: 5.3.0
Resolving yarn version 1.3.2...
Downloading and installing yarn (1.3.2)...
Installed yarn 1.3.2
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (yarn.lock)
yarn install v1.3.2
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.30s.
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 20.7M
-----> Launching...
Released v12
https://dmdb-1.herokuapp.com/ deployed to Heroku
Rebuilt app using NPM instead of Yarn and it deployed without issue and is running fine now. Thanks for the help!
THIS SOLUTION IS FOR GO .
When you deploy an app through heroku, it does not allow you to specify the port number.
In other words, you can not specify your web service's port number as 8000 or something else, heroku decides the port number in runtime.
so, you can not use the following code:
log.Fatal(http.ListenAndServe(":8000", router))
What you can do is, getting the runtime port of heroku.
In short, just use the following code:
log.Fatal(http.ListenAndServe(":" + os.Getenv("PORT"), router))