phpcpd, You need to set up the project dependencies using composer install - jenkins

I've just installed phpcpd globally via following command:
sudo composer global require 'sebastian/phpcpd=
my ~/composer/vendor/bin/ directory is in my $PATH variable too.
Now when I try to run phpcpd I get following error:
You need to set up the project dependencies using the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install
Any idea what I'm doing wrong here?
Thanks.

The point Sebastian didn't mention in the installation instructions is that by using Composer to globally install PHPCPD, you don't get it's dependencies installed, only the direct code. You have to go to the PHPCPD directory in the global vendor directory (i.e. the PHPCPD main folder in there, something like ...somepath/.composer/vendor/sebastian/phpcpd/) and run composer install there.
The easier way would be to just install the .phar file, but I understand this has different issues.

Related

Lumber: Command 'lumber' not found

I just setup a Rails Application in my Ubuntu 18 machine, and I want to connect it to Forest Admin. However, Forest Admin requires that I set up a Node Application using npm first. The node application requires the installation of Lumber CLI tool in order to install Forest Admin.
I have however installed Lumber CLI tool by running the command below:
npm install -g lumber-cli#latest -s
When I run the command below npm lumber -version in my command line terminal, I get the response:
6.13.4
But when I try to generate the Forest Admin using the command below:
lumber generate "my_project"...
I get the following error:
Command 'lumber' not found
I need some help. Thank you.
Here's how I solved it:
The issue is because NPM does not have the write access to the directory that will contain the package you want to install (here lumber-cli).
To solve this issue, override the default directory where your global NPM packages will be stored:
mkdir ~/.npm-global
Then, configure NPM to use this directory instead of the default one:
npm config set prefix '~/.npm-global'
Then, make the node executables accessible from your PATH. To do so, export the environment variable PATH by opening or creating the file ~/.profile and add this line at the end:
export PATH=~/.npm-global/bin:$PATH
Finally, reload the ~/.profile file:
source ~/.profile
Try installing lumber cli again using the command below:
npm install -g lumber-cli#latest -s
It should be able to install lumber without any error, and also display the directory where lumber-cli is installed.
Reference: Prevent permission errors at installation
That's all
I hope this helps

Ubuntu, shopsys install via composer, docker, still crashing

I wanna install shopsys via composer and docker, as is recommended.
https://github.com/shopsys/shopsys/blob/master/docs/installation/installation-using-docker-linux.md
I installed git, php-fpm (configured), postgres (configured), composer, docker, docker-compose.
sudo apt install git
sudo apt install php7.2-fpm
sudo apt install postgresql
sudo apt install composer
sudo apt install docker-ce
sudo apt install docker-compose
Everything ok.
I added my user to docker group.
sudo usermod -a -G docker $(whoami)
Ok.
Next I made folder /var/www/html/shopsys, created project shopsys via composer.
composer create-project shopsys/project-base --no-install --keep-vcs
cd project-base/
Then I run this in /var/www/html/shopsys/project-base.
./scripts/install.sh
Everything seems to be ok, until this.
[RuntimeException]
/var/www/html/vendor does not exist and could not be created.
I set rights to 777 for folder /var/www/html, and run it again, but same problem.
The I run this.
sudo composer install
It shows me this error.
....Exception\InvalidConfigurationException]
Invalid configuration for path "monolog.handlers.main": You can only use ex
cluded_http_codes/excluded_404s with a FingersCrossedHandler definition
In ScriptHandler.php line 294:
An error occurred when executing the "'shopsys:domains-urls:configure'" command:
In BaseNode.php line 319:
...\Exception\InvalidConfigurationException]
Invalid configuration for path "monolog.handlers.main": You can only use ex
cluded_http_codes/excluded_404s with a FingersCrossedHandler definition
...
etc., error is quite ugly.
Last error when i run script install.sh.
file_put_contents(/var/www/html/vendor/composer/installed.json): failed to open stream: Permission denied
But this folder does not exist.
ls: cannot access '/var/www/html/vendor/': No such file or directory
Just question, where could be the problem?
Is possible to download sources from some link, extract it, configure and display in web browser with easy way, for example as wordpress?
Thanks.
To solve problem with vendor:
It seems that your UID and GID is different than default 1000, that is set in docker-compose.yml for Linux by default.
To solve your issue you can continue by step 3 in https://github.com/shopsys/shopsys/blob/master/docs/installation/installation-using-docker-linux.md#3-set-the-uid-and-gid-to-allow-file-access-in-mounted-volumes
You found issue with installation script, I have created issue on GitHub.
To solve problem with Invalid configuration for path "monolog.handlers.main":
Currently there is problem with new minor version (3.4.0) of symfony/monolog-bundle that created BC break. There is already created issue about this problem and there is already merged fix in Shopsys master.
To solve problem in your project you have to add
"symfony/monolog-bundle": ">=3.4.0", in conflict section in your composer.json file and then run composer install again.
We are trying to answer questions on stackoverflow as soon as possible, but we also have Slack where is many users and you might get your question answered much faster.

sudo luarocks command not found on centos7

I installed luarocks on centos7, then I execute 'luarocks install luacheck', there is an error:
'Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.'
So, I execute 'sudo luarocks install luacheck', but there is also an error:
'sudo luarocks command not found'.
I confirm that luarocks has installed correctly, bucause when I execte 'luarocks --version' shows:
/usr/bin/luarocks 2.4.2
As luarocks isn't installed using the native package manager its installed to /usr/local/bin. This isn't in the PATH variable available in the sudo context - you can see (and edit) the configured paths in the secure_path property in the sudoers file.
Workaround that I use it to add a symbolic link to a path included in the secure_path property: sudo ln -s /usr/local/bin/luarocks /usr/bin/luarocks
You can either use
sudo /usr/bin/luarocks install luacheck
to install luacheck system-wide
or
luarocks --local install luacheck
to install to your user only. To use the second option, you also need to run
eval $(luarocks path --bin)
to make sure that the Lua paths are updated in your shell. To make these Lua paths permanent, you can add the above line to your shell config file (~/.bash_profile or similar).

jhipster application files generated in wrong directory

When I try to create a jhipster application in ubuntu 13.10 with yo jhipster the generated output files are always dumped in the wrong directory.
For example I run yo jhipster in the directory /mnt/mercury/jhipster-test/alpha then the files are dumped out to /mnt/mercury. In fact if I run yo jhipster in any subdirectory of /mnt/mercury they are always dumped out to /mnt/mercury.
I'm using yo version 1.1.2 from the standard ubuntu repository
Please advise how to generate files to be output in current directory.
For the benefit of anyone else facing this problem.
I managed to get Yeoman working with the following
npm cache clean
sudo npm rm -g yo
npm cache clean
sudo npm install -g yo
My problem: Accidentally "yo generating" in the parent directory.
Solution: Delete the .yo-rc.json file in the parent directory, then running the yo generator command in the child directory.
As discussed in the comments, this is a Yeoman problem on Ubuntu 13.10:
We don't have this issue with Ubuntu 12.04
There is the same issue with other generators ("yo webapp") on Ubuntu 13.10
As a workaround, I recommend you have a look at our Docker container:
https://github.com/jhipster/jhipster-docker
This will allow you to run the full JHipster stack, with Ubuntu 12.04, inside a container! Just use it to generate the app, then you can work directly on your host machine.
On Mac OSX Maverick with Node v0.10.26, yo v1.1.2 and generator-jhipster v0.11, the yo hipster command was generating all the sources always in the same (wrong!) directory and not using my current directory.
I fixed this problem doing the following:
cd <WRONG_DIR_WHERE_CODE_IS_CREATED>
rm .yo-rc.json node_modules/
npm uninstall -g karma
npm install -g karma (Note: using sudo it was not working!)
sudo npm install -g generator-jhipster
Not sure why but I've then been able to install karma and generator-jhipster again and suddenly yo hipster starting generating code again in my current directory
Could it be caused by different environment variables when launching npm with sudo?
The file .yo-rc.json is hidden, if it is not deleted, the generator will constantly take the settings from it. You must delete .yo-rc.json.

nosetests --with-pylons test.ini => Error: no such option: --with-pylons

I followed the application to run the tests of pylons project:
http://pylonshq.com/docs/en/0.9.7/i18n/#testing-the-application
But when I run:
nosetests --with-pylons test.ini
It reports an error:
E:\pylons\helloworld>nosetests --with-pylons test.ini
Usage: nosetests-script.py [options]
nosetests-script.py: error: no such option: --with-pylons
Why nosetests doesn't know the --with-pylons, how to fix it?
If you are using Pylons 1.0.1, the nose plugin is not registered by Pylons itself any more.
A workaround is to add this to the entry_points section of your own project's setup.py:
[nose.plugins]
pylons = pylons.test:PylonsPlugin
This error happens in cases where nose cannot find installed pylons.
This can happen if nose is installed system-wide (for example, via apt-get install python-nose), but Pylons is installed in virtual environment. In that case you can either:
Install Pylons system-wide, that would pollute your global environment and defeat the purpose of having virtual environment
Install nose in virtual environment (easy_install -U nose when virtual environment is activated)
If you've installed the latest version of pylons using pip, version 1.0.1rc1 is installed. Nose is not able to find the pylons-plugin.
To fix this downgrade to pylons 1.0.
pip uninstall pylons
pip install pylons==1.0
I had the same problem and found the solution here
I never used --with-pylons. When I am in the directory of the project, nosetests does the job without any parameters.
I'm on Linux, with the proper virtualenv activated. Maybe it's different on Windows.

Resources