cdils / utility-pro

Utility Pro Theme
GNU General Public License v2.0
14 stars 5 forks source link

Error running composer install #115

Closed jdelia closed 6 years ago

jdelia commented 7 years ago

I receive an error after checking out 2.0.0-dev branch and run composer install https://cl.ly/2i203o2w0g2T

Expected Behavior

Thought I would load a fresh copy of UPRO 2.0 to have a look at the blog page template issue.

Current Behavior

This is a fresh install for 2.0.0-dev - tried running composer install first. Received the error. Ran npm install and that finished without error.

Possible Solution

Not sure what is wrong.

Steps to Reproduce (for bugs)

  1. create a fresh genesis install
  2. clone the repo, fetch and checkout 2.0.0-dev
  3. run composer install
  4. see this error:

[utility-pro] (2.0.0-dev)$ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files

"vendor/bin/phpcs" --config-set installed_paths ../../wp-coding-standards/wpcs PHP Fatal error: Uncaught Error: Call to undefined function did_action() in /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/tgmpa/tgm-plu gin-activation/class-tgm-plugin-activation.php:2109 Stack trace:

0 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/composer/autoload_real.php(66): require()

1 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/composer/autoload_real.php(56): composerRequire77a62ca96cd94535a00b72d63329e908('a5f882

d89ab791a...', '/Users/loneduch...')

2 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/autoload.php(7): ComposerAutoloaderInit77a62ca96cd94535a00b72d63329e908::getLoader()

3 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(27): include_once('/Users/loneduch...')

4 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/the in /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/tgmpa/tgm-plu

gin-activation/class-tgm-plugin-activation.php on line 2109

Fatal error: Uncaught Error: Call to undefined function did_action() in /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/tgmpa/tgm-plugin-a ctivation/class-tgm-plugin-activation.php:2109 Stack trace:

0 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/composer/autoload_real.php(66): require()

1 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/composer/autoload_real.php(56): composerRequire77a62ca96cd94535a00b72d63329e908('a5f882

d89ab791a...', '/Users/loneduch...')

2 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/autoload.php(7): ComposerAutoloaderInit77a62ca96cd94535a00b72d63329e908::getLoader()

3 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(27): include_once('/Users/loneduch...')

4 /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/the in /Users/loneduchess/Local Sites/utility-pro-2/app/public/wp-content/themes/utility-pro/vendor/tgmpa/tgm-plu

gin-activation/class-tgm-plugin-activation.php on line 2109 Script "vendor/bin/phpcs" --config-set installed_paths ../../wp-coding-standards/wpcs handling the install-standards event returned with error code 255

Context

Unable to proceed.

Your Environment

gspice commented 7 years ago

My Environment

The same as Jackie's, using Local with PHP 7.0.3 , WordPress 4.8, nginx server

local-environment

My Steps and Results (a little different)

/Users/Ginger/Local Sites/upro2/app/public/wp-content/themes/utility-pro-2.0.0-dev/node_modules/gulp-wp-pot/index.js:54 contents: Buffer.from(potContents) TypeError: this is not a typed array. at Function.from (native) at DestroyableTransform._flush (/Users/Ginger/Local Sites/upro2/app/public/wp-content/themes/utility-pro-2.0.0-dev/node_modules/gulp-wp-pot/index.js:54:24) at DestroyableTransform.<anonymous> (/Users/Ginger/Local Sites/upro2/app/public/wp-content/themes/utility-pro-2.0.0-dev/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:138:49) at DestroyableTransform.g (events.js:260:16) at emitNone (events.js:67:13) at DestroyableTransform.emit (events.js:166:7)

Context

At this point, I am stalled until I can learn further instructions.

GaryJones commented 7 years ago

Will look more and post better instructions tomorrow, but Ginger's is due to Local not supporting Composer by default, and then running it from her machine, instead of right-click -> Open in SSH (which would then use the right version of PHP). Not the fault of UP2.

Jackie's looks like it's pulling down not-the-right version of TGMPA, where we've fixed a recent global call. Replace it was develop branch, which includes a return, and the post install composer script should work fine.

GaryJones commented 7 years ago

Right click the site and Open in SSH. Then:

apt-get update && apt-get install -y wget
wget -qO- https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

screenshot showing composer being added to Local by Flywheel SSH

The Local SSH needs some prep work.

# Allow Code Standards to be installed
cd /app/public/wp-content/themes/utility-pro/vendor/squizlabs/php_codensniffer
chmod 666 CodeSniffer.conf

# Install sudo, curl, git and apt-transport-https packages.
apt-get install sudo curl git apt-transport-https

# Add repo for Node.JS 8.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

# Install Node.JS 8 and npm.
sudo apt-get install -y nodejs

# Optionally, add repo for Yarn (alternative for npm).
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

# Optionally install Yarn.
sudo apt-get install yarn

# Tidy up any un-needed libraries.
apt-get autoremove

Now you should be able to:

cd app/public/wp-content/themes/utility-pro
composer install
jdelia commented 7 years ago

@GaryJones Thanks for this. I will run through this again over the weekend and see if I can get things working properly.

gspice commented 7 years ago

Same here: I will be able to focus better on getting this working over the weekend.

gspice commented 7 years ago

@GaryJones Thank you for your detailed instructions!

My steps today:

console-errors

Also attaching my full SSH window contents for reference: Terminal-Saved-Output.txt

GaryJones commented 7 years ago

@gspice I don't think you pulled down the latest version of UP 2.0.0-dev before starting, as your output (useful to include, thanks!) shows you have TGMPA 2.6.1 instead of the develop branch.

gspice commented 7 years ago

@GaryJones You are correct, I had the previous develop branch, this time I downloaded 2.0.0-dev.

Steps and results today:

Here's my terminal output:

Terminal-Saved-Output-July-23.txt

GaryJones commented 7 years ago

@gspice Still the same error.

Before doing a composer install, do a composer update, so that it updates the lock file. Right now, it still pulled down TGMPA 2.6.1, and not the dev-develop.

See the:

Error: Call to undefined function did_action() in /app/public/wp-content/themes/utility-pro-2.0.0-dev/vendor/tgmpa/tgm-plugin-activation/class-tgm-plugin-activation.php on line 2109

This was fixed by adding https://github.com/TGMPA/TGM-Plugin-Activation/blob/ec6a3f286e095facdabb19aa1b9e5f2794dddf51/class-tgm-plugin-activation.php#L35-L38 to the start of that TGMPA file.

I'll see about getting a new TGMPA release done this week.

Also, you could update your system PHP, and then use composer on your host machine (not inside Local's SSH) to do the composer actions.

gspice commented 7 years ago

@GaryJones I'm closer! :-)

Error: Missing binding /Users/Ginger/Local Sites/upro2/app/public/wp-content/themes/utility-pro-2.0.0-dev/node_modules/node-sass/vendor/darwin-x64-47/binding.node Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 5.x

Found bindings for the following environments:

This usually happens because your environment has changed since running npm install. Run npm rebuild node-sass --force to build the binding for your current environment.

GaryJones commented 7 years ago

The npm rebuild should be a one-off task, each time you update Node.

The gulp-wp-pot issue can be reported at https://github.com/rasmusbe/gulp-wp-pot to see if they can identify the issue.

cdils commented 6 years ago

@jdelia I'm closing this out. I'll upload a fresh branch for testing before Monday and please create a new issue if the problem persists.