-1

我正在尝试安装 laravel Spark,但无论我尝试哪种方法都会出现很多错误。

添加文件后"laravel/spark": "*@dev"composer.js我收到此错误。

在任何版本中都找不到请求的包 laravel/spark,包名可能有拼写错误。

任何线索是什么问题?

"require": {
  "php": ">=5.5.9",
  "laravel/framework": "5.2.",
  "laravel/cashier": "~6.0",
  "laravel/spark": "@dev"
}

添加到composer.js文件中并运行composer update. 得到找不到错误。

4

1 回答 1

0

在您的composer.json文件中,将以下内容添加到该require部分(请注意,与您当前列出的内容相比,该部分*在符号前有一个星号@):

"laravel/spark": "*@dev"

然后将其添加到它自己的部分(或相应地更新):

"repositories": [
    {
        "type": "path",
        "url": "./spark",
        "options": {
            "symlink": false
        }
    }
],

options部分是可选的,您可以将其省略

然后,您可以运行您的composer install命令。你可以通过运行来确认一切正常composer validate,这会触发一个警告,忽略它也没关系。您还应该检查composer.lock文件以确保其中有类似的内容:

{
    "name": "laravel/spark",
    "version": "dev-develop",
    "dist": {
        "type": "path",
        "url": "./spark",
        "reference": "072b0bf217fbbe5018fc062612bb1fb5566d94e1",
        "shasum": null
    },
    "require": {
        "erusev/parsedown": "~1.0",
        "firebase/php-jwt": "~3.0|~4.0",
        "guzzlehttp/guzzle": "~6.0",
        "intervention/image": "^2.3",
        "php": ">=5.5.9",
        "ramsey/uuid": "^3.1"
    },
    "require-dev": {
        "mockery/mockery": "0.9.*",
        "mpociot/vat-calculator": "^1.6",
        "phpunit/phpunit": "~5.0"
    },
    "type": "library",
    "extra": {
        "branch-alias": {
            "dev-master": "4.0-dev"
        }
    },
    "autoload": {
        "psr-4": {
            "Laravel\\Spark\\": "src/"
        }
    },
    "license": [
        "MIT"
    ],
    "authors": [
        {
            "name": "Taylor Otwell",
            "email": "taylorotwell@gmail.com"
        }
    ],
    "description": "Laravel Spark provides scaffolding for Laravel SaaS applications.",
    "keywords": [
        "billing",
        "laravel",
        "saas",
        "scaffolding",
        "stripe"
    ],
    "transport-options": {
        "symlink": false
    }
},

此外,根据您的版本和设置方式,您必须查看文档,因为有几种不同的设置方法:

https://spark.laravel.com/docs/6.0/installation#installation-via-composer

我还要补充一点,您永远不应该修改目录中的./spark文件。所有更改都在./resources/assets/js/sparkor中进行./resources/views/vendor/spark(并且一如既往,您可以覆盖app目录中的任何内容,除非您更改了命名空间)。

哦,这些命令可能对您有用(显然将它们转换为实际的别名或带别名的函数):

alias reset
    rm -rf composer.lock node_modules package-lock.json vendor
    composer install
    npm install
    gulp
    composer validate

alias update
    rm -rf node_modules vendor
    composer install
    npm install
    composer update
    npm update
    reset

不过,我只会将它们作为分支主机运行,团队成员不必为 Composer 和 npm 进行依赖项更新。

于 2018-06-22T01:06:21.493 回答