首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Drupal 9上安装Google分析?

如何在Drupal 9上安装Google分析?
EN

Stack Overflow用户
提问于 2021-09-12 07:22:02
回答 1查看 55关注 0票数 0

我刚安装了Drupal 9。

Composer.json

代码语言:javascript
复制
{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "require": {
        "composer/installers": "^1.9",
        "drupal/core": "self.version",
        "drupal/core-project-message": "self.version",
        "drupal/core-vendor-hardening": "self.version"
    },
    "require-dev": {
        "behat/mink": "^1.8",
        "friends-of-behat/mink-browserkit-driver": "^1.4",
        "behat/mink-goutte-driver": "^1.2",
        "behat/mink-selenium2-driver": "^1.4",
        "composer/composer": "^2.0.2",
        "drupal/coder": "^8.3.10",
        "fabpot/goutte": "^3.3",
        "instaclick/php-webdriver": "^1.4.1",
        "mikey179/vfsstream": "^1.6.8",
        "phpunit/phpunit": "^8.5.14 || ^9",
        "phpspec/prophecy": "^1.12",
        "symfony/css-selector": "^4.4",
        "symfony/phpunit-bridge": "^5.3.0",
        "symfony/var-dumper": "^5.3.0",
        "symfony/error-handler": "^4.4",
        "justinrainbow/json-schema": "^5.2",
        "symfony/filesystem": "^4.4",
        "symfony/finder": "^4.4",
        "symfony/lock": "^4.4",
        "symfony/browser-kit": "^4.4",
        "symfony/dom-crawler": "^4.4 !=4.4.5",
        "easyrdf/easyrdf": "^0.9 || ^1.0"
    },
    "replace": {
        "paragonie/random_compat": "9.99.99",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal9",
        "platform": {
            "php": "7.3.0"
        }
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "installer-paths": {
            "core": ["type:drupal-core"],
            "libraries/{$name}": ["type:drupal-library"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        },
        "drupal-core-project-message": {
            "post-install-cmd-message": [
                "drupal/drupal: This package is meant for core development,",
                "               and not intended to be used for production sites.",
                "               See: https://www.drupal.org/node/3082474"
            ],
            "post-create-project-cmd-message": [
                "drupal/drupal: This package is meant for core development,",
                "               and not intended to be used for production sites.",
                "               See: https://www.drupal.org/node/3082474"
            ]
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Drupal\\Composer\\": "composer"
        }
    },
    "scripts": {
        "pre-install-cmd": "Drupal\\Composer\\Composer::ensureComposerVersion",
        "pre-update-cmd": "Drupal\\Composer\\Composer::ensureComposerVersion",
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
        "drupal-phpunit-upgrade": [
            "@composer update phpunit/phpunit --with-dependencies --no-progress",
            "@composer require phpspec/prophecy-phpunit:^2 --no-progress --no-suggest"
        ],
        "post-update-cmd": [
            "Drupal\\Composer\\Composer::generateMetapackages"
        ],
        "phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
        "phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
    },
    "repositories": [
        {
            "type": "path",
            "url": "core"
        },
        {
            "type": "path",
            "url": "composer/Plugin/ProjectMessage"
        },
        {
            "type": "path",
            "url": "composer/Plugin/VendorHardening"
        },
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ]
}

我读过,最好用Composer来安装模块。所以我在努力

代码语言:javascript
复制
php8.0 /usr/local/bin/composer  require drupal/google_analytics
Using version ^3.1 for drupal/google_analytics
./composer.json has been updated
Running composer update drupal/google_analytics
> Drupal\Composer\Composer::ensureComposerVersion
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/google_analytics[dev-3.x, 3.1.0] require drupal/core ^8.8.6|^9.0 -> satisfiable by drupal/core[8.8.6, ..., 8.9.x-dev, 9.0.0-alpha1, ..., 9.3.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[dev-main] from path repo (core) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
    - drupal/google_analytics 3.x-dev is an alias of drupal/google_analytics dev-3.x and thus requires it to be installed too.
    - Root composer.json requires drupal/google_analytics ^3.1 -> satisfiable by drupal/google_analytics[3.1.0, 3.x-dev (alias of dev-3.x)].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

如何理解这些错误?看起来需要Drupal 8或9,但我有9,所以为什么会有问题?我看到有提到的优先事项,我读了https://getcomposer.org/doc/articles/repository-priorities.md,但我没有得到我需要修复的工作。你能看出来吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-12 18:52:56

已删除的供应商目录。Ran Composer安装。安装后注意到的消息

代码语言:javascript
复制
drupal/drupal: This package is meant for core development,

               and not intended to be used for production sites.

               See: https://www.drupal.org/node/3082474

包裹已经干净了。

在链接中,我看到了Composer命令来创建新项目,因此我将其修改为这个项目,并尝试:

代码语言:javascript
复制
composer  -n create-project drupal/recommended-project:* drupal3

然后按照安装步骤https://www.drupal.org/docs/installing-drupal

然后尝试安装谷歌分析--而且没有问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69149308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档