Composer搜索/和路径



我正在将我的PHP应用程序部署到Microsoft Azure平台。在部署时,它运行composer install,并且在窗口中存在反斜杠问题:对于项目和库中的每个类,它都使用/和\作为路径分隔符来解析文件。成千上万的这种错误出现了:

Warning: Ambigous class resolution. "SomeClass" was found in both
"D:/home/site/wwwroot/vendor/somevendeor/somelib/src/SomeClass.php" and 
"D:homesitewwwrootvendorsomevendeorsomelibsrcSomeClass.php"

对每个文件进行两次分析并通过网络打印所有错误需要很长时间,Azure取消了编写过程。部署失败了9次(共10次)(使应用程序处于无效、不起作用的状态)。

有人知道该怎么办吗?我很感激每一个提示!谢谢:)

编辑:这是我的作文。json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "require": {
        "laravel/framework": "4.2.*",       
        "cartalyst/sentry": "2.0.*",
        "facebook/php-sdk-v4": "4.0.*",
        "thetwelvelabs/foursquare": "dev-master@dev",
        "hybridauth/hybridauth": "*",
        "caouecs/laravel4-lang": "*",
        "phpoffice/phpexcel": "*",
        "google/apiclient": "*"
    },
    "autoload": {
        ...
    },
    "scripts": {
        ...
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"
}

编辑2:这是我的deploy.sh(在Azure上推送Repo成功后执行):

#!/bin/bash
# ----------------------
# KUDU Deployment Script
# Version: 0.2.2
# ----------------------
# Helpers
# -------
exitWithMessageOnError () {
  if [ ! $? -eq 0 ]; then
    echo "An error has occurred during web site deployment."
    echo $1
    exit 1
  fi
}
# Prerequisites
# -------------
# Verify node.js installed
hash node 2>/dev/null
exitWithMessageOnError "Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment."
# Setup
# -----
SCRIPT_DIR="${BASH_SOURCE[0]%\*}"
SCRIPT_DIR="${SCRIPT_DIR%/*}"
ARTIFACTS=$SCRIPT_DIR/../artifacts
KUDU_SYNC_CMD=${KUDU_SYNC_CMD//"}
if [[ ! -n "$DEPLOYMENT_SOURCE" ]]; then
  DEPLOYMENT_SOURCE=$SCRIPT_DIR
fi
if [[ ! -n "$NEXT_MANIFEST_PATH" ]]; then
  NEXT_MANIFEST_PATH=$ARTIFACTS/manifest
  if [[ ! -n "$PREVIOUS_MANIFEST_PATH" ]]; then
    PREVIOUS_MANIFEST_PATH=$NEXT_MANIFEST_PATH
  fi
fi
if [[ ! -n "$DEPLOYMENT_TARGET" ]]; then
  DEPLOYMENT_TARGET=$ARTIFACTS/wwwroot
else
  KUDU_SERVICE=true
fi
if [[ ! -n "$KUDU_SYNC_CMD" ]]; then
  # Install kudu sync
  echo Installing Kudu Sync
  npm install kudusync -g --silent
  exitWithMessageOnError "npm failed"
  if [[ ! -n "$KUDU_SERVICE" ]]; then
    # In case we are running locally this is the correct location of kuduSync
    KUDU_SYNC_CMD=kuduSync
  else
    # In case we are running on kudu service this is the correct location of kuduSync
    KUDU_SYNC_CMD=$APPDATA/npm/node_modules/kuduSync/bin/kuduSync
  fi
fi
##################################################################################################################################
# Download Composer
# ----------
echo Downloading Composer
curl -sS https://getcomposer.org/installer | php
##################################################################################################################################
# Deployment
# ----------
echo "Switching to Maintenance Mode"
cd $DEPLOYMENT_TARGET
php artisan down
exitWithMessageOnError "Failed to turn maintenance on (php artisan down)"
echo Handling Basic Web Site deployment.
# 1. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
  "$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
  exitWithMessageOnError "Kudu Sync failed"
fi
##################################################################################################################################
# Dependency install
# ----------
# Invoke Composer in the deployment directory
echo Invoking composer install in deployment directory $DEPLOYMENT_TARGET
cd $DEPLOYMENT_TARGET
php $DEPLOYMENT_TARGET/composer.phar install -v --prefer-dist --no-dev --optimize-autoloader --no-interaction
echo Deleting all active Sessions
rm -f $DEPLOYMENT_TARGET/app/storage/sessions/*
echo Deleted all active Sessions
echo Clearing the cache
rm -f $DEPLOYMENT_TARGET/app/storage/cache/*
echo Cache Cleared
##################################################################################################################################
# Post deployment stub
if [[ -n "$POST_DEPLOYMENT_ACTION" ]]; then
  POST_DEPLOYMENT_ACTION=${POST_DEPLOYMENT_ACTION//"}
  cd "${POST_DEPLOYMENT_ACTION_DIR%\*}"
  "$POST_DEPLOYMENT_ACTION"
  exitWithMessageOnError "post deployment action failed"
fi
echo "Turning off Maintenance Mode"
cd $DEPLOYMENT_TARGET
php artisan up
exitWithMessageOnError "Failed to turn maintenance off (php artisan up)"
echo "Finished successfully."

我使用您提供的详细信息尝试了git部署。它对我有效,有以下更改

您的部署脚本引用了artisan文件。我不得不删除下面的

部署.sh

   php artisan down
   php artisan up

我在package.json中没有您的脚本/自动加载详细信息

  "autoload": {
        ...
    },
    "scripts": {
        ...
    },

查看上面的配置更改,并检查这是否解决了您的问题。

相关内容

  • 没有找到相关文章

最新更新