felixrieseberg / ember-cli-azure-deploy

:wrench: Build Ember Cli Apps on Azure Websites
MIT License
19 stars 2 forks source link

npm EPERM errors and RangeError's on web app in azure #12

Open adam-knights opened 8 years ago

adam-knights commented 8 years ago

Hi,

I'm now on a B2 web app, so 3.75gb of ram so things actually start to run now. However, I get these errors:

Installing ember-cli-azure-deploy
D:\local\AppData\npm\azure-deploy -> D:\local\AppData\npm\node_modules\ember-cli-azure-deploy\bin\azure-deploy
D:\local\AppData\npm
npm WARN EPACKAGEJSON D:\local\AppData\npm No description
└── ember-cli-azure-deploy@1.3.1 
npm WARN EPACKAGEJSON D:\local\AppData\npm No repository field.

npm WARN EPACKAGEJSON D:\local\AppData\npm No README data
bower already installed, nothing to do
npm WARN EPACKAGEJSON D:\local\AppData\npm No license field.
deploy.sh: eval: line 119: syntax error near unexpected token `('
deploy.sh: eval: line 119: `D:\Program Files (x86)\nodejs\0.10.32\node.exe -v'
Using Node Using npm 3.1.0
Using bower 1.6.3
Using ember-cli-azure-deploy 1.3.1
Cleaning Cache
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "d:\\Program Files (x86)\\nodejs\\0.10.32\\node.exe" "D:\\Program Files (x86)\\npm\\3.1.0\\node_modules\\npm\\bin\\npm-cli.js" "cache" "clean"
An error has occurred during web site deployment.
npm ERR! node v0.10.32
npm cache cleaning failed
npm ERR! npm  v3.1.0
npm ERR! path D:\local\AppData\npm-cache
npm ERR! code EPERM
npm ERR! errno 50

npm ERR! Error: EPERM, lstat 'D:\local\AppData\npm-cache'
npm ERR!  { [Error: EPERM, lstat 'D:\local\AppData\npm-cache']
npm ERR!   errno: 50,
npm ERR!   code: 'EPERM',
npm ERR!   path: 'D:\\local\\AppData\\npm-cache' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

Here is our current package.json:

{
  "name": "orders-app",
  "version": "0.0.0",
  "description": "Small description for orders-app goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "start": "ember server",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "body-parser": "^1.14.1",
    "broccoli-asset-rev": "^2.1.2",
    "broccoli-jscs": "^1.1.0",
    "ember-cli": "1.13.8",
    "ember-cli-app-version": "0.5.0",
    "ember-cli-babel": "^5.1.3",
    "ember-cli-bootstrap-datepicker": "0.5.5",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.1",
    "ember-cli-htmlbars": "0.7.9",
    "ember-cli-htmlbars-inline-precompile": "^0.2.0",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "^1.3.1",
    "ember-cli-qunit": "^1.0.0",
    "ember-cli-release": "0.2.3",
    "ember-cli-sass": "5.0.0",
    "ember-cli-sri": "^1.0.3",
    "ember-cli-uglify": "^1.2.0",
    "ember-cli-windows-addon": "^1.2.2",
    "ember-composability": "0.2.0",
    "ember-data": "1.13.12",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.3",
    "ember-modal-dialog": "0.8.1",
    "ember-simple-auth": "1.0.0",
    "express": "^4.13.3",
    "glob": "^5.0.15",
    "morgan": "^1.6.1"
  }
}

bower.json

{
  "name": "orders-app",
  "ignore": [],
  "dependencies": {
    "ember": "1.13.10",
    "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
    "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
    "ember-data": "1.13.12",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
    "ember-qunit": "0.4.9",
    "ember-qunit-notifications": "0.0.7",
    "ember-resolver": "~0.1.18",
    "jquery": "^1.11.3",
    "loader.js": "ember-cli/loader.js#3.2.1",
    "qunit": "~1.18.0",
    "bootstrap": "~3.3.5",
    "jquery-ui": "~1.11.4",
    "momentjs": "~2.10.6",
    "bootstrap-datepicker": "~1.4.1"
  }
}
adam-knights commented 8 years ago

Still getting these @felixrieseberg, here is what deploy.sh currently is incase it helps:

#!/bin/bash

# ----------------------
# KUDU Deployment Script
# Version: 0.1.11
# ----------------------

# 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."

# Verify that we have access to tar
hash tar 2> /dev/null
exitWithMessageOnError "Missing tar. I figured as much."

# Setup
# -----
echo Copy assets to $DEPLOYMENT_TEMP for build
tar cf - --exclude=node_modules --exclude=bower_components --exclude=dist --exclude=tmp --exclude=.git . | (cd $DEPLOYMENT_TEMP && tar xvf - )
exitWithMessageOnError "Failed to create and extract tarball"

echo Switch to the temp directory
cd $DEPLOYMENT_TEMP

if [[ -d node_modules ]]; then
  echo Removing node_modules folder
  rm -Rf node_modules
  exitWithMessageOnError "node_modules removal failed"
fi

SCRIPT_DIR="${BASH_SOURCE[0]%\\*}"
SCRIPT_DIR="${SCRIPT_DIR%/*}"
ARTIFACTS=$SCRIPT_DIR/../artifacts
KUDU_SYNC_CMD=${KUDU_SYNC_CMD//\"}
NODE_EXE="$PROGRAMFILES\\nodejs\\0.10.32\\node.exe"
NPM_CMD="\"$NODE_EXE\" \"$PROGRAMFILES\\npm\\3.1.0\\node_modules\\npm\\bin\\npm-cli.js\""
NODE_MODULES_DIR="$APPDATA\\npm\\node_modules"

EMBER_PATH="$NODE_MODULES_DIR\\ember-cli\\bin\\ember"
BOWER_PATH="$NODE_MODULES_DIR\\bower\\bin\\bower"
AZUREDEPLOY_PATH="$NODE_MODULES_DIR\\ember-cli-azure-deploy\\bin\\azure-deploy"

EMBER_CMD="\"$NODE_EXE\" \"$EMBER_PATH\""
BOWER_CMD="\"$NODE_EXE\" \"$BOWER_PATH\""
AZUREDEPLOY_CMD="\"$NODE_EXE\" \"$AZUREDEPLOY_PATH\""

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

##################################################################################################################################
# Installing dependencies to take load of ember-cli install
# -----

echo Installing ember-cli
eval $NPM_CMD install --no-optional --no-bin-links ember-cli
exitWithMessageOnError "ember-cli failed"

echo Installing ember-cli-azure-deploy
eval $NPM_CMD install -g ember-cli-azure-deploy
exitWithMessageOnError "ember-cli-azure-deploy failed"

if [[ ! -e "$BOWER_PATH" ]]; then
  echo Installing bower
  eval $NPM_CMD install --global --no-optional --no-bin-links bower
  exitWithMessageOnError "bower failed"
else
  echo bower already installed, nothing to do
fi

##################################################################################################################################
# Print Versions
# -----

echo -n "Using Node "
eval $NODE_EXE -v

echo -n "Using npm "
eval $NPM_CMD -v

echo -n "Using bower "
eval $BOWER_CMD -v

echo -n "Using ember-cli-azure-deploy "
eval $AZUREDEPLOY_CMD -v

##################################################################################################################################
# Build
# -----

echo Cleaning Cache
eval $NPM_CMD cache clean
exitWithMessageOnError "npm cache cleaning failed"

echo Installing npm modules
eval $NPM_CMD install --no-optional --no-bin-links
exitWithMessageOnError "npm install failed"

echo Installing bower dependencies
eval $BOWER_CMD install
exitWithMessageOnError "bower install failed"

echo Build the dist folder
eval $AZUREDEPLOY_CMD build
exitWithMessageOnError "ember-cli-azure-deploy build failed"

echo Copy web.config to the dist folder
cp web.config dist\

##################################################################################################################################
# Deployment
# ----------

if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
  "$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_TEMP/dist" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
  exitWithMessageOnError "Kudu Sync failed"
fi

##################################################################################################################################
# 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 "Finished successfully."
felixrieseberg commented 8 years ago

Hm... I'm still not entirely sure why this would be failing. Can you maybe just comment out eval $NPM_CMD cache clean? We're running that just in case something goes wrong with the cache, but it shouldn't be required.

adam-knights commented 8 years ago

I upgraded to version 1.4.0 that you released yesterday. The error messages changed to:

./Web.config
Switch to the temp directory
Installing ember-cli

undefined:0
(null)

RangeError: Maximum call stack size exceeded
An error has occurred during web site deployment.
ember-cli failed

I then tried your suggestion of commenting out eval $NPM_CMD cache clean, same error.

adam-knights commented 8 years ago

@felixrieseberg We are at a stage where we have a tester working off our integration server. I need to make a decision whether to abandon ember-cli-azure-deploy for the time being and invest time trying to get Jenkins to do a build and ftp after it has run our tests. This largely depends on how quickly you think we can find a resolution to the issues above?

felixrieseberg commented 8 years ago

Honestly, Jenkins will always be dramatically better at building. Ember Cli is a beast and this has always been for people on a shoestring budget - I would have loved to get this to work for you, but there are probably a bunch of limitations on Web Apps in general that will make this pretty tough.

adam-knights commented 8 years ago

Thanks, we'll move forward with jenkins and if this issue gets resolved in future I'll revisit the addon :)

phoad commented 8 years ago

If you get "call stack exceeded" error while deploying with this method then you can skip the deploy step of ember-cli or ignore the failure, and the deployment script still should work and your site will work at Azure too. (give it a try).

echo Installing ember-cli eval $NPM_CMD install --no-optional --no-bin-links ember-cli exitWithMessageOnError "ember-cli failed"

As you see "exitWithMessageOnError" is called after trying to install the ember-cli. I have altered the code in here, basically removing this line is the same. Then I could be able to successfully deploy and see my webpage is working.

I saw that

echo Build the dist folder eval $AZUREDEPLOY_CMD build exitWithMessageOnError "ember-cli-azure-deploy build failed"

this step is also already installing ember-cli successfully.

josealonsogarcia commented 7 years ago

Same error here when tries to create the symlinks

Running without elevated rights. Running Ember CLI "as Administrator" increases performance significantly.
See www.ember-cli.com/user-guide/#windows for details.

BuildingBuild failed.
The Broccoli Plugin: [Funnel: Funnel: index.html] failed with:
Error: EPERM: operation not permitted, symlink 'D:\local\Temp\8d3ba0df6e6d303\app' -> 'D:\local\Temp\8d3ba0df6e6d303\tmp\funnel-input_base_path-OiYN8BJa.tmp\0'

Is there a solution for this? I googled about but I didn't find an answer...