最近,我完全忽略了composer.lock和package-lock.json(可能不相关),并且我更改了gulp部署脚本,以使用composer安装而不是composer更新。在将新代码推送到产品服务器之前,我使用composer update和npm update将锁文件更新为最新版本,以确保分支合并中没有任何异常。
但是gulp部署脚本遇到了很多问题,其中最成问题的是:“需求无法解决一组可安装的软件包”
gulp-tasks / deploy.js处于当前状态:
var args = require('yargs').argv;
var exec = require('./helpers/exec');
var runSequence = require('run-sequence');
module.exports = function (gulp, plugins, settings) {
return function (completed) {
var jsBundle = [];
// Set production / staging only bundling options
settings.env === 'production' || settings.env === 'staging'
? jsBundle.push('js:bundle-production')
: jsBundle.push('js:bundle-vendor', 'js:bundle-vue', 'js:bundle-core');
if (!args.x) { // Exclude mode
console.log('Fetching latest commits from remote repository..');
exec('git fetch');
try {
console.log('Attempting to merge upstream branch into local..');
exec('git merge'); // If up-stream set on branch, merge it into local branch
} catch (e) {}
}
if (args.v) { // Checkout version tag
console.log('Checking out release tag..');
exec('git checkout tags/' + args.v);
}
if (args.s) { // Speed mode
console.log('Building JS and SASS..');
runSequence(
'make:htaccess',
'sass:compile',
'js:bundle-login',
jsBundle,
'copy-public',
'remove:config',
completed
);
} else if (args.b) {
runSequence(
'make:htaccess',
'remove:config',
completed
);
} else {
// Full deploy
// Create array for additional tasks we can pipe things like bugsnag into (this can't be empty)
var extraTasks = ['remove:config'];
if (settings.env === settings.production) {
extraTasks.push('bugsnag'); // Add Bugsnag source maps on production
}
console.log('Installing composer packages..');
exec('composer install');
console.log('Installing NPM packages & pruning old packages..');
exec('npm prune');
// If deploying to a version then we don't want any potential package or package.lock changes saved
if (args.v) {
exec('npm install --no-save');
} else {
exec('npm install');
}
runSequence(
'make:htaccess',
'sass:compile',
'js:bundle-login',
jsBundle,
'copy-public',
extraTasks,
completed
);
}
if (args.u) {
console.log('Running unit tests..');
try {
exec('./vendor/bin/phpunit --bootstrap tests/unit/bootstrap.php -c tests/unit/phpunit.xml tests/unit');
} catch (e) {}
}
if (args.y) {
try {
console.log('Updating system packages..');
exec('[ -n "$(which yum)" ]');
exec('sudo yum -y update');
} catch (e) {
console.log('yum not found.');
}
}
}
};
composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "git",
"url": "https://company/repo/iputils.git"
},
{
"type": "git",
"url": "https://company/repo/phpwhois.git"
}
],
"autoload": {
"psr-4": {"company\\Database\\": "database/src"}
},
"require": {
"php": ">=7.1",
"ext-dom": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-SimpleXML": "*",
"adobe-marketing-cloud/marketing-cloud-php-sdk": "2.1.x",
"atrapalo/majesticseo-php-api-connector": "0.9.*",
"aveiv/open-exchange-rates-api": "1.1",
"aws/aws-sdk-php": "3.*",
"bshaffer/oauth2-server-php": "1.10",
"bugsnag/bugsnag": "^3.0",
"diggin/diggin-http-charset": "dev-master",
"eloquent/enumeration": "5.*",
"google/apiclient": "2.1.*",
"guzzlehttp/guzzle": "6.*",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"h4cc/wkhtmltoimage-amd64": "0.12.x",
"intervention/image": "^2.3",
"knplabs/knp-snappy": "^0.4.3",
"kunststube/rison": "0.92",
"league/csv": "^9.0",
"pelago/emogrifier": "@dev",
"php-di/php-di": "6.0.x",
"companyrepo/iputils": "dev-master",
"companyrepo/phpwhois": "dev-4-stable",
"ramsey/uuid": "2.8.*",
"shazam/php-slack": "^0.1.0",
"sameer-shelavale/php-countries-array": "*",
"symfony/intl": "^3.1",
"zendframework/zendframework1": "1.*",
"zendframework/zendframework": "3.*",
"zendframework/zend-http": "2.7.0",
"johnpbloch/wordpress-core-installer": "^1.0",
"johnpbloch/wordpress-core": "4.9.*",
"wpackagist-plugin/advanced-text-widget": "2.0.*",
"wpackagist-plugin/drafts-of-post-revisions": "0.8.*",
"wpackagist-plugin/image-widget": "4.2.*",
"wpackagist-plugin/inline-google-spreadsheet-viewer": "0.10.*",
"wpackagist-plugin/posts-to-posts": "1.6.*",
"wpackagist-plugin/post-types-order": "1.8.*",
"wpackagist-plugin/simple-page-ordering": "2.2.*",
"wpackagist-plugin/wp-migrate-db": "0.*",
"wpackagist-plugin/wp-cerber": "6.*",
"zircote/swagger-php": "dev-master",
"simshaun/recurr": "3.0.5",
"robmorgan/phinx": "*",
"fzaninotto/faker": "*"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "6.*",
"phploc/phploc": "*",
"phpmd/phpmd": "*",
"slevomat/coding-standard": "~4.0",
"squizlabs/php_codesniffer": "3.*"
},
"extra": {
"wordpress-install-dir": "public/support/wp",
"installer-paths": {
"public/support/support-content/plugins/{$name}/": ["type:wordpress-plugin"]
}
}
}
我们在生产服务器上运行的Deploy命令:gulp deploy -v tagversionnumber
其中一台产品服务器上的Composer诊断示例:
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.aveiv/open-exchange-rates-api : exact version constraints (1.1) should be avoided if the package follows semantic versioning
require.bshaffer/oauth2-server-php : exact version constraints (1.10) should be avoided if the package follows semantic versioning
require.diggin/diggin-http-charset : unbound version constraints (dev-master) should be avoided
require.pelago/emogrifier : unbound version constraints (@dev) should be avoided
require.companyrepo/iputils : unbound version constraints (dev-master) should be avoided
require.sameer-shelavale/php-countries-array : unbound version constraints (*) should be avoided
require.zendframework/zend-http : exact version constraints (2.7.0) should be avoided if the package follows semantic versioning
require.zircote/swagger-php : unbound version constraints (dev-master) should be avoided
require.simshaun/recurr : exact version constraints (3.0.5) should be avoided if the package follows semantic versioning
require.robmorgan/phinx : unbound version constraints (*) should be avoided
require.fzaninotto/faker : unbound version constraints (*) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: WARNING
You are not running the latest stable version, run `composer self-update` to update (1.3.0 => 1.7.2)
某些服务器正在运行composer 1.2.2
在同一产品服务器composer install --dry-run
上:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for zendframework/zend-soap 2.7.0 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
Problem 2
- zendframework/zendframework 3.0.0 requires zendframework/zend-soap ^2.6 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zendframework 3.0.0 requires zendframework/zend-soap ^2.6 -> satisfiable by zendframework/zend-soap[2.7.0].
- zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
- Installation request for zendframework/zendframework 3.0.0 -> satisfiable by zendframework/zendframework[3.0.0].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php-7.1.d/10-opcache.ini
- /etc/php-7.1.d/20-bz2.ini
- /etc/php-7.1.d/20-calendar.ini
- /etc/php-7.1.d/20-ctype.ini
- /etc/php-7.1.d/20-curl.ini
- /etc/php-7.1.d/20-dom.ini
- /etc/php-7.1.d/20-exif.ini
- /etc/php-7.1.d/20-fileinfo.ini
- /etc/php-7.1.d/20-ftp.ini
- /etc/php-7.1.d/20-gd.ini
- /etc/php-7.1.d/20-gettext.ini
- /etc/php-7.1.d/20-iconv.ini
- /etc/php-7.1.d/20-imap.ini
- /etc/php-7.1.d/20-json.ini
- /etc/php-7.1.d/20-mbstring.ini
- /etc/php-7.1.d/20-mysqlnd.ini
- /etc/php-7.1.d/20-pdo.ini
- /etc/php-7.1.d/20-phar.ini
- /etc/php-7.1.d/20-posix.ini
- /etc/php-7.1.d/20-shmop.ini
- /etc/php-7.1.d/20-simplexml.ini
- /etc/php-7.1.d/20-sockets.ini
- /etc/php-7.1.d/20-sqlite3.ini
- /etc/php-7.1.d/20-sysvmsg.ini
- /etc/php-7.1.d/20-sysvsem.ini
- /etc/php-7.1.d/20-sysvshm.ini
- /etc/php-7.1.d/20-tokenizer.ini
- /etc/php-7.1.d/20-xml.ini
- /etc/php-7.1.d/20-xmlwriter.ini
- /etc/php-7.1.d/20-xsl.ini
- /etc/php-7.1.d/20-zip.ini
- /etc/php-7.1.d/30-mysqli.ini
- /etc/php-7.1.d/30-pdo_mysql.ini
- /etc/php-7.1.d/30-pdo_sqlite.ini
- /etc/php-7.1.d/30-wddx.ini
- /etc/php-7.1.d/30-xmlreader.ini
- /etc/php-7.1.d/40-apcu.ini
- /etc/php-7.1.d/php.ini
请注意,ext-soap也不在我们的本地环境中,但是在那里安装正常。而且作曲家更新在产品和本地上都可以正常工作
答案 0 :(得分:1)
您应该安装并启用php-soap扩展。
zendframework/zend-soap 2.7.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.