Installing PHPUnit on MAMP 2.1.3 (Mountain Lion) - phpunit

I'm struggling with this issue.
Here's what I've tried :
$ cd /Applications/MAMP/bin/php/php5.4.10/bin/
$ sudo ./pear channel-update pear.php.net
$ sudo ./pear upgrade pear
$ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear channel-discover pear.phpunit.de
$ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear channel-discover pear.symfony-project.com
$ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear install phpunit/PHPUnit
So it seems to work, but phpunit is actually installed in
/Applications/MAMP/bin/php3/bin/
If I tried to launch it from there, it doesn't work (no output, no log). If I move it to the php 5.4.10 folder, it still doesn't work.
I've replaced the Mac OS php cli with MAMP's :
$ which php
/Applications/MAMP/bin/php/php5.4.10/bin/php
As suggested on some website, I've also tried to remove
/Applications/MAMP/bin/php/php5.4.10/conf/pear.conf
But nothing seems to help.
Any idea ?

I'd recommend using composer. It's becoming a standard.
To start with, go to your project's root directory first and create a composer.json file there:
{
"require-dev": {
"phpunit/phpunit": "*"
},
"autoload": {
"psr-0": {"": "src"}
},
"config": {
"bin-dir": "bin"
}
}
You can tune it to your needs later. You'll probably want to configure the autoloading if you'd like to leverage composer's autoloader (which I recomend).
Next download the composer:
curl -sS https://getcomposer.org/installer | php
The above script will not only download it but also verify your environment if it's suitable to run composer binary.
If everything goes well install your dependencies:
./composer.phar install --dev
PHPUnit binary will be installed in the bin directory (configured in composer.json):
./bin/phpunit --version

I've met this problem this morning and find this topic but no answer is helpful. After a couple of hours google search, I found this link, it helped me solve my problem
http://www.startupcto.com/server-tech/macosx/installing-phpunit-on-mamp
My MAMP php version is 5.5.3
First, you'll probably need to update PEAR:
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear channel-update pear.php.net
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear upgrade pear
After that, add the appropriate PEAR channels for PHPUnit:
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear channel-discover pear.phpunit.de
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear channel-discover pear.symfony.com
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear channel-discover components.ez.no
Finally, install PHPUnit:
sudo /Applications/MAMP/bin/php/php5.5.3/bin/pear install phpunit/PHPUnit
Test phpunit to make sure it was installed correctly:
/Applications/MAMP/bin/php/php5.5.3/bin/phpunit --version
Link phpunit to your path
sudo ln -s /Applications/MAMP/bin/php/php5.5.3/bin/phpunit /usr/local/bin/phpunit
Hope this help you and anyone meet this problem in the future!

You could try this solution from this site
The php bin could vary from installation.
/Applications/MAMP/bin/php5/bin/pear channel-discover pear.phpunit.de
/Applications/MAMP/bin/php5/bin/pear channel-discover pear.symfony-project.com
/Applications/MAMP/bin/php5/bin/pear channel-discover components.ez.no
/Applications/MAMP/bin/php5/bin/pear install phpunit/PHPUnit

Related

after I `npm install -g` something, I cannot use the CLI commands from the installed package

my npm install -g is not working as intended. It installs the package I need, however the CLI commands which comes from the package is always absent.
One example is, I was following the quick start on TypeORM.
It says
First, install TypeORM globally:
npm install typeorm -g
Then go to the directory where you want to create a new project and run the command:
typeorm init --name MyProject --database mysql
but when I tried typeorm init --name MyProject --database mysql. I got the error -bash: typeorm: command not found I think it has something to do with my environment path setting.
This is the output from my echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/Postgres.app/Contents/Versions/latest/bin
Can someone help me with this?
OK I figured this out myself. Solution is here : https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
In Linux/Unix, if you are a normal user, i.e. not root, you cannot install global packages, as these packages are written to system folders. In your case, -g is doing nothing as it cannot access system folders, so it is installed locally as any other regular package. in order to fix your problem, you have to gain more privileges. To do so, you can run the command at the root level i.e:
sudo npm install typeorm -g
and then you can access it from anywhere as -g is intended to put it as global; no need to play with environment path settings as -g also take care of doing so.
if you need a bash session as full root (a root terminal, or in windows terms a cmd/powershell running as administrator) without really signing in to root account for security purpose, use:
sudo -i
and then do whatever you want as root without writing sudo everytime :D; as i said, this command opens the current terminal session as root, so you have to write it in each new opened terminal.
Hope it helps :D (It wiill actually ;))
To install package binary globally, npm needs to create links to /usr/local/bin, which may not happen if you don't give it permission. Try running with sudo.
$ sudo npm install typeorm -g
You can run
$ which typeorm
To check if it's installed properly.
You can use node version manager (nvm). But first uninstall your node.js.
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
Then
command -v nvm
Then exit and open your terminal.
Then you can install any version of node.js.
For install the latest version type:
nvm install node
When the installation is complete install your package:
npm install typeorm -g
Then it should work correctly.
I think im a bit late but it might help someone :D
sudo npm install typeorm -g --unsafe-perm

How to set up phpUnit alias for laravel project?

I installed phpunit using composer to project.
composer require --dev phpunit/phpunit ^7
It is installed correctly. But how to set up aliases to use
~$ phpunit
to run all tests.
I found that ~$ vendor/bin/phpunit works. Where and how to set up alias for that in Ubuntu 18.04?
You could just set up an alias in your ~/bash_profile
alias phpunit='vendor/bin/phpunit'
Now you can enter
~$ phpunit
in your project and the local phpunit from vendor/bin/phpunit will be executed.
An alias you talk about is for global use, the phpunit inside the vendor folder is for that project only.
Install PHPunit globally
Install PHPunit globally if you want to use $ phpunit everywhere (more info).
$ wget https://phar.phpunit.de/phpunit-6.5.phar
$ chmod +x phpunit-6.5.phar
$ sudo mv phpunit-6.5.phar /usr/local/bin/phpunit
$ phpunit --version

Compiling: conflicting types for 'sigset_t'

I'm trying to compile the wazuh manager. I've done the following:
$ sudo apt-get install gcc make git libc6-dev
$ mkdir ossec_tmp && cd ossec_tmp
$ git clone -b stable https://github.com/wazuh/wazuh.git ossec-wazuh
$ cd ossec-wazuh
$ sudo ./install.sh
This gives me an error as such:
In file included from /usr/include/asm/signal.h:26:0,
from /usr/include/linux/signal.h:5,
from /usr/include/linux/aio_abi.h:32,
from engines/afalg/e_afalg.c:43:
/usr/include/asm-generic/signal.h:92:3: error: conflicting types for 'sigset_t'
} sigset_t;
I then went and tried compiling without shared library only the agent by running:
sudo make -C src DISABLE_SHARED=1 TARGET=agent
This seem to give the exact same error. Anyone able to assist me here to debug?
I can recommend you to follow the manager installation guide of our documentation.
As I can see you want to install the server in a folder called 'ossec_tmp', I recommend you to create the folder and after that following the guide, when you launch
./install
It will ask you for the path where you want to install the service.
Here is a link to the documentation:
https://documentation.wazuh.com/current/installation-guide/installing-wazuh-server/sources_installation.html
Hope it helps.

firebase-tools error: EACCES: permission denied

I am trying to deploy Firebase hosting of my web app.
At the command line, when I type firebase deploy, I get the following error.
Note: firebase deploy is just one example. The same error occurs for all firebase commands. (e.g., firebase --help, firebase -v, firebase login, firebase logout, etc.)
Error
/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/mowzer/.config/configstore/update-notifier-firebase-tools.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:123:23)
at Object. (/usr/local/lib/node_modules/firebase-tools/bin/firebase:5:48)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
Everything I have tried so far (including every CLI firebase instruction) rejects me for lack of access.
What can I do? What should I try?
(I am on a Mac OSX Yosemite v10.10.5 and firebase-tools v3.0.3)
Edit: When I do sudo firebase deploy, I get the following error.
Error: The entered credentials were incorrect.
I tried the following solution.
I tried to delete problem files then reinstall firebase-tools.
Terminal.sh
cd
cd .config/configstore
# Delete problematic files
rm firebase-tools.json
override rw------- root/staff for firebase-tools.json? y
rm update-notifier-firebase-tools.json
override rw------- root/staff for update-notifier-firebase-tools.json? y
# Reinstall firebase-tools
cd
sudo npm install -g firebase-tools
Then...
cd path/to/directory
cd firebase deploy
Now this file generates the error:
/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
cd /usr/local/lib/node_modules/firebase-tools/node_modules/configstore
I fix it by adding sudo at the beginning of the command line!
This looks like an issue with the permissions of modules you have npm installed. This is something lots of developers run into, and npm actually has some documentation on how to resolve it. Once you go through that, try again (you may need to re-install firebase-tools) and things should work.
I had the same issue, and I fixed it by using this command curl -sL firebase.tools | upgrade=true bash
Add sudo prior to command it should work
sudo npm -g i firebase-tools
I had the same issue, and I fixed it by doing chmod 755 on all the files in the configstore directory
Expanding more detail to the solution provided by #jacobawenger:
The most robust solution is to install Homebrew and let Homebrew manage the npm package installation for you.
Terminal.sh
# EACCESS error reference: https://docs.npmjs.com/getting-started/fixing-npm-permissions
# Install Homebrew # Reference: brew.sh # Ensures NPM is installed properly to avoid EACCESS errors
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install npm # Reference: brew.sh
brew install node
# Install firebase-tools
npm install -g firebase-tools # Non-recurring task # Also updates to newest version (see notice)
Easy Way:
Back up your computer.
if you have Permission issue run first this
sudo chown -R $USER /usr/local/lib/node_modules
then 2nd
1)- mkdir ~/.npm-global
2)- npm config set prefix '~/.npm-global'
3)- export PATH=~/.npm-global/bin:$PATH
4)- source ~/.profile
5)- npm install -g jshint
6)- NPM_CONFIG_PREFIX=~/.npm-global
You can try using the --unsafe-perm flag. Just like this:
sudo npm install -g firebase-tools --unsafe-perm
Try run the command as
su root
if you are using ubuntu.
For me, just use sudo, did not work.
I'm using Ubuntu 18.x.x and I was trying install firebase through npm
What worked for me was basically reinstalling the node using the node version manager.
For this, you just install latest node js version this way
In my case at the point of this reply, the LTS Version of the Node JS is v14.17.0 hence nvm use 14.17.0 now try re-running the build.
i faced the same issue recently.
running this command solved the issue for me
sudo chown -R $USER ~/.config/configstore
There's information explaining why the sudo command makes the difference, and generally, when we are calling commands in terminal mode, we are not recognised as the computer's administrator, whereas certain commands are reserved for the administrator only. The sudo command enables terminal commands to be executed as the administrator. You can read about the sudo command here : )
Thank you for your contributions towards resolving this issue.

Meteor app not starting up. Was working on 0.7.0.1. Doesn't on 0.7.1 or 0.7.2

The following is what I get when I start up my app:
meteor [[[[[ ~/......./app ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Starting your app...
It used to work on Meteor 0.7.1, but when I upgraded to 0.7.2 it never finishes loading up. Now I can't even run it on 0.7.1, only 0.7.0.1.
This happens to all my meteor apps on my computer. Any ideas of what the problem is or how I debug it?
The problem was a badly commented CSS file. I opened a comment tag in a CSS file and didn't close it which is what caused the problem.
You've posted this a couple of times. I've seen the problem with some of my projects. While I can't guarantee it will work, I hope it gives you a bit of an idea of where to look to clear your older data.
Look for all .build folders in your project and delete them.
cd your-project-name
rm -rf .build
cd .meteor
rm -rf .build
(Also repeat the same for your package folders)
Sounds like your install of Meteor is corrupt. Do a clean install:
Uninstall Meteor:
sudo rm `where meteor`
rm -rf ~/.meteor
Uninstall Meteorite:
sudo mrt uninstall
sudo mrt uninstall --system
sudo chown -R `whoami` ~/.npm
Install Meteor:
curl https://install.meteor.com | /bin/sh
Install Meteorite:
http://oortcloud.github.io/meteorite/

Resources