Cannot install phantomJS in Karma - phantomjs

WARN [config]: config.configure() is deprecated, please use config.set() instead.
WARN [plugin]: Cannot find plugin "karma-phantomjs".
Did you forget to install it ?
npm install karma-phantomjs --save-dev
INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/
WARN [launcher]: Can not load "PhantomJS", it is not registered!
Perhaps you are missing some plugin?
Getting this error. When running npm install karma-phantomjs --save-dev I get an error.
npm ERR! 404 'karma-phantomjs' is not in the npm registry.
I installed karma-phantomjs-launcher --save-dev but i still get an error when running grunt watch.
Anyone else run into this issue?

npm install karma-jasmine --save-dev
npm install karma-phantomjs-launcher --save-dev
Then add the following line to karma.config.js
plugins : ['karma-jasmine', 'karma-phantomjs-launcher']

I got tripped up by this today running
karma: 0.13.7
karma-phantomjs-launcher: 1.0.0
What isn't very obvious is that the launcher has a dependency on:
phantomjs-prebuilt
So if you, install this locally everything should run fine, eg:
npm install phantomjs-prebuilt --save-dev

After some research I realized that I needed to run:
npm install -g karma#canary phantomjs karma-phantomjs-launcher
Once I ran that I went back into my karma-unit.tpl.js file and instead of karma-phantomjs, I changed this to karma-phantomjs-launcher.
Now when I execute a command like grunt build, I get no error regarding phantomJS

This is an issue still open on the repo: #31
Strangely enough the following worked for my Debian based system:
apt-get install libfontconfig
How did I get into this? Reading a comment from the ticket. Hope this will help for others too :-)

I'm running in a CentOS 7 Docker container. Had similar issue.
Had to:
yum install -y tar bzip2 freetype fontconfig
Then
npm install phantomjs --save-dev
worked without errors, which allowed
npm install karma-phantomjs-launcher --save-dev
and that allowed
gulp test
to run without Karma or PhantomJS errors.

Today I had the same. I deleted all the temporary directories and, after rerun it worked.
Before that i also reinstalled phantomjs but without success. It's possible that this influenced, anyway (but i think deleting the temporary directories did the job). Anyway, after deleting temporary folders you can try, if it didn't work you can reinstall phantomjs and also other stuff as other users already wrote.

Related

I can't run ganache in my terminal, even though it's installed

It seems I have a path error, I can see proof the package installed, and I've tried it both globally and local, tried both with and w/o the -cli suffix, but zshell keeps complaining command not found
dr_frankenmiller#Bryans-MacBook-Pro ~ % npm install ganache-cli
npm WARN deprecated ganache-cli#6.12.2: ganache-cli is now ganache; visit https://trfl.io/g7 for details
added 1 package, and audited 102 packages in 11s
2 packages are looking for funding
run npm fund for details
9 vulnerabilities (8 moderate, 1 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit for details.
dr_frankenmiller#Bryans-MacBook-Pro ~ % npm ls --depth=0
dr_frankenmiller# /Users/dr_frankenmiller
└── ganache-cli#6.12.2
dr_frankenmiller#Bryans-MacBook-Pro ~ % ganache-cli
zsh: command not found: ganache-cli
I might have done something bad, using a sudo rm -rf node_modules command to uninstall the package, was that dangerous to do? I reinstalled it globally and then tried running it again, and then zshell started complaining I wasn't authorized to run ganache. I tried the command sudo ganache, it asked me for password, and then responded again that command not found.
Can someone help me get back on track with my tutorial?
According to Ganache-CLI's instructions, it should be installed with:
npm install ganache-cli -g
I'd recommend installing the latest Ganache version rather than installing Ganache-CLI, though. Ganache-CLI is deprecated. Use
npm uninstall ganache-cli && npm install ganache -g
Ganache v7.0.0 and onward can be used in the CLI as well as programatically.
On another note, I strongly recommend against using sudo when installing anything via npm. This can give untrusted code the ability to run as admin on your system. Definitely a big security risk.
Just a follow up on difficulties I was having, I ended up using yarn to download and run ganache (MINUS the -cli suffix, -cli suffix now deprecated), yarn install ganache --global to install and then yarn ganache to run (no -cli necessary)
Here's how I found the solution for my specific use case. The bug came about when I was attempting to run a brownie deployment script. Run npm uninstall ganache-cli then run yarn global add ganache. Worked like a charm.

error installing cypress on windows 64 with npm

I'm seeing an error when attempting to install the latest cypress on my Windows 10 machine. I was using cypress 8.7 just fine. I deleted node_modules and package-lock.json and removed "cypress": "^8.7.0", from package.json.
Now installing cypress (9.1) I see this error:
npm install --save-dev cypress
npm ERR! Error: Cannot find module 'har-validator'
I see the same error when trying to use the old version too
npm install --save-dev cypress#8.7.0
System info from powershell:
node -v
> v16.8.0
npm -v
> 7.21.0
UPDATE:
My friend is able to install with dependency 8.7.0 in package.json, on OSX with nodejs 14.16.0.
This works today (2021-11-26) for me
npm install --save-dev cypress#8.7.0
There is a Bug in #cypress/request.
Take a look at https://github.com/cypress-io/request/pull/15
EDIT: There is a PR from one of the devs. https://github.com/cypress-io/request/pull/16
Looks like Cypress issue with latest versions. we have this problem for v8.7.0 today. "npm install har-validator" manually installed the missing har-validator module, that helped.

Cannot get "npm install #feathers/cli -g" to work in the command line

I get this error message when I try installing feathers from npm
npm WARN deprecated nomnom#1.8.1: Package no longer supported. Contact support#npmjs.com for more info.
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
Help!!
As Vasan pointed out in the comments, running
npm install -g #feathersjs/cli
from the command prompt on Windows installs a file feathers.cmd in the folder:
%APPDATA%\npm
If this folder is not on your PATH, then feathers will not be recognised as an executable - it appears that the global install doesn't add it to the path automatically.
Editing system environment variables to add this folder to your path should make the feathers cli tools available.
Note that after altering your path you may need to restart your terminal for the updated path to be available.
Its very simple, if you have an earlier version installed, uninstall the old feathers-cli using:
npm uninstall feathers-cli -g
Then install #feathersjs/cli and upgrade a project by the following commands:
npm install #feathersjs/cli -g
cd path/to/project
feathers upgrade
I also faced with the installation issue. But got an error: 404 Not Found: babel-messages#^6.23.0. I've solved it when run npm install #feathersjs/cli -g through the windows terminal (cmd). Before that I was running it on bash.
This issue also occurs when installation is ran using Admin credential(Windows 10), reinstall without elevated cmd/powershell credential also solved the problem.

NPM Cannot read property '0' of undefined

After updated Node (upto v8.6.0) and npm (upto v5.5.1) I cannot execute command npm install.
After npm install I've error message:
npm ERR! Cannot read property '0' of undefined
What's trouble or I need downgrade node/npm ?
I had the same problem.
I removed both node_modules and package-lock.json and then did:
npm install
And it worked.
Edit by #OwlyMoly
Due to new updates and the restriction to old dependencies in package-lock.json is causing this conflicts. By doing npm install won't fix this issue. Instead by ditching npm_modules and package-lock.json and doing npm install will load a new node_modules and that supposed to be required by package.json. You have to commit the new package-lock.json along with your latest changes of the project.
Do 2 steps bellow (Window):
rm -rf ./node_modules to remove node folder
rm package-lock.json to remove package-lock.json file
then npm install to re-install the node modules
Just download and install latest Yarn which is also a node package manager, developed by facebook, but has a much better dependency management. Also update your node cli (optional).
And then, install your dependencies using yarn:
yarn install
or
yarn // short version of yarn install
No errors!
You can continue to use npm after you have installed all dependencies with yarn or continue with yarn....it's your choice.
I've made some tests:
nodejs#8.6.0 npm#5.5.1 - I have trouble and the test fails
nvm use 8.5.0
nodejs#8.5.0 npm#5.5.1 - I have trouble and the test fails
nvm use 8.4.0
nodejs#8.4.0 npm#5.5.1 - I have trouble and the test fails
npm install npm#^5 -g
nodejs#8.4.0 npm#5.4.2 - I have trouble and the test fails
nvm use 8.6.0
npm install npm#^4 -g
nodejs#8.6.0 npm#4.6.1 - no trouble, this fixes it.
Seems to be an issue with a combination of factors.
Some workarounds here:
https://github.com/npm/npm/issues/18238
npm 5.3.0 is broken for windows 10 after upgrading the nodeJS.
You should downgrade the npm, it is a temporary solution but works fine.
npm install -g npm#5.2.0
For me (npm#6.9.0) solved the issue by deleting node_modules and performing npm install, but without removing package.json.lock file.
Just remove both node_modules and package-lock.json and run: npm install
or
Just run: npm install -g npm#latest to upgrade it to the latest version
Try with nvm(Node Version Manager).it help you to install any node version for any project without any Error.
I found same problem when using npm version 5.5.1 to install babel-preset-stage-0
Solution:
I downgraded npm to version 5.2.0 and try to install again then it can solve the issue.
npm i -g npm#5.2.0
npm i -D babel-preset-stage-0
I bumped into this issue using nvs (Node Version Switcher - https://github.com/jasongin/nvs) node#10.15.3 and npm#6.9.0. The reason was a local package I had linked with npm link. The solution was to remove that folder.
In my case reinstalling node_modules have not fixed this issue.
Problem was with one *.ts file which was missing in source codes.
Do not know why It was not displaying compilation error, but adding this missing file to repository solved this issue.
Upgrading npm to version 7.5.4 did the job for me.
npm install -g npm#latest
What worked for me:
npm ci
Install a project with a clean slate
docs: https://docs.npmjs.com/cli/v7/commands/npm-ci
Deletes node_modules and installs everything based on package-lock.json, so no need to regenerate that

Windows: Unable to find "grunt.js" config file

Under Windows, I am getting the following error when I run grunt on my project:
Unable to find "grunt.js" config file. Do you need any --help?
I have exactly the same configuration as my mac and its failing - anyone seen this?
Here's what I did to fix this:
Uninstalled grunt globally:
npm uninstall -g grunt
Installed grunt-cli globally:
npm install -g grunt-cli
Then, in project root dir:
npm install
And all is good. Hope this works for anyone else running into this.