Node.js sites with *.sln files under node_modules folder fail to deploy #688

Closed
tjanczuk opened this Issue Jul 11, 2013 · 7 comments

Projects

None yet

3 participants

@tjanczuk
Contributor

The scenario is a Node.js site with checked in node_modules folder that contains *.sln files in some of the native modules (e.g. edge.js).

Repro steps:

mkdir pr31415
cd pr31415
git init .
npm install edge
echo console.log('foo') > server.js
git add .
git commit -am "first"
azure site create pr31415 --git
git push azure master

The last command generates:

C:\repro\modules>git push azure master
Password for 'https://janczuk@pr27.scm.azurewebsites.net':
Counting objects: 121, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (112/112), done.
Writing objects: 100% (121/121), 1.15 MiB | 84 KiB/s, done.
Total 121 (delta 12), reused 0 (delta 0)
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '76b502afd9'.
remote: Unable to determine which solution file to build. C:\DWASFiles\Sites\pr27\VirtualDirectory0\site\repository\node
_modules\edge\node_modules\edge-cs\src\edge-cs\edge-cs.sln, C:\DWASFiles\Sites\pr27\VirtualDirectory0\site\repository\no
de_modules\edge\performance\BookService\BookService.sln.
remote: Error - Changes committed to remote repository but your website not updated.
To https://janczuk@pr27.scm.azurewebsites.net/pr27.git
 * [new branch]      master -> master

Expected: successful deployment.

@amitapl amitapl was assigned Jul 31, 2013
@amitapl
Member
amitapl commented Jul 31, 2013

Fixed by 05f8f18

@amitapl amitapl closed this Jul 31, 2013
@tjanczuk
Contributor
tjanczuk commented Dec 2, 2013

A Node.js site with *.sln files under node_modules appears to deploy fine, but build of the *.sln files is still attempted during git push azure master (and it fails). Is that expected?

Try deploying any site with the mongodb dependency for instance:

remote: Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
remote: MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET
 Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path i
f it is installed elsewhere.  [C:\DWASFiles\Sites\mobilechapters\VirtualDirectory0\site\wwwroot\node_modules\mongodb\nod
e_modules\kerberos\build\binding.sln]
remote: Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
remote: MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET
 Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path i
f it is installed elsewhere.  [C:\DWASFiles\Sites\mobilechapters\VirtualDirectory0\site\wwwroot\node_modules\mongodb\nod
e_modules\bson\build\binding.sln]
@davidebbo
Member

I'll let @amitapl comment on this further, but I think I can give you a workaround:

In the portal, create an app setting called SCM_SCRIPT_GENERATOR_ARGS, and set it to --node.

See here for more info.

@davidebbo davidebbo reopened this Dec 2, 2013
@amitapl
Member
amitapl commented Dec 6, 2013

I can't repro this, when I add mongodb it deploys fine (not trying to build anything).

@tjanczuk
Contributor
tjanczuk commented Dec 7, 2013

I have a custom deploy script generated by a not-so-new version of the sdk, perhaps that is the culprit?

@echo off

:: ----------------------
:: KUDU Deployment Script
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=node "%appdata%\npm\node_modules\kuduSync\bin\kuduSync"
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "%NPM_JS_PATH%"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. KuduSync
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd %DEPLOYMENT_TARGET%
  call !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

goto end

:error
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
echo Finished successfully.
@amitapl
Member
amitapl commented Dec 7, 2013

The custom deployment script doesn't build anything so it still doesn't explain it.
Can you share a repo that fails?

@amitapl
Member
amitapl commented Feb 20, 2014

Closing as I can't repro the issue, reopen if there is new information.

@amitapl amitapl closed this Feb 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment