Error installing npm package on Azure app service

2019-08-16 20:05发布

Was able to successfully build better-sqlite3 and integer@1.0.1 with npm install on Linux and Windows 7 without a problem. However have issue on Azure. Have following error:

> npm install integer -dd
�[37;40mnpm info it worked if it ends with ok
�[37;40mnpm �[34;40mverb cli [ 'D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe',
�[37;40mnpm �[34;40mverb cli   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\bin\\npm-cli.js',
�[37;40mnpm �[34;40mverb cli   'install',
�[37;40mnpm �[34;40mverb cli   'integer',
�[37;40mnpm �[34;40mverb cli   '-dd' ]
�[37;40mnpm info using npm@5.5.1
�[37;40mnpm info using node@v8.9.0
�[37;40mnpm �[34;40mverb npm-session 8016124db333a5c2
�[37;40mnpm �[32;40mhttp fetch GET 304 https://registry.npmjs.org/integer 283ms (from cache)
�[37;40mnpm �[34;40mverb correctMkdir D:\local\Temp\monacositeextension\temp\_locks correctMkdir not in flight; initializing
�[37;40mnpm �[34;40mverb lock using D:\local\Temp\monacositeextension\temp\_locks\staging-7ccd117e5dc1e199.lock for D:\home\site\wwwroot\node_modules\.staging
�[37;40mnpm info lifecycle to-descriptor@1.0.1~preuninstall: to-descriptor@1.0.1
�[37;40mnpm info lifecycle to-descriptor@1.0.1~uninstall: to-descriptor@1.0.1
�[37;40mnpm �[34;40mverb unbuild rmStuff to-descriptor@1.0.1 from D:\home\site\wwwroot\node_modules
�[37;40mnpm info lifecycle to-descriptor@1.0.1~postuninstall: to-descriptor@1.0.1
�[37;40mnpm info lifecycle lzz-gyp@0.4.2~preuninstall: lzz-gyp@0.4.2
�[37;40mnpm info lifecycle lzz-gyp@0.4.2~uninstall: lzz-gyp@0.4.2
�[37;40mnpm �[34;40mverb unbuild rmStuff lzz-gyp@0.4.2 from D:\home\site\wwwroot\node_modules
�[37;40mnpm info lifecycle lzz-gyp@0.4.2~postuninstall: lzz-gyp@0.4.2
�[37;40mnpm info lifecycle integer@1.0.1~preinstall: integer@1.0.1
�[37;40mnpm info linkStuff integer@1.0.1
�[37;40mnpm �[34;40mverb linkBins integer@1.0.1
�[37;40mnpm �[34;40mverb linkMans integer@1.0.1
�[37;40mnpm info lifecycle integer@1.0.1~install: integer@1.0.1
gyp info it worked if it ends with ok
gyp verb cli [ 'D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe',
gyp verb cli   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.9.0 | win32 | ia32
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:13:12)\n    at F (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:68:19)\n    at E (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:80:29)\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:89:16\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\node_modules\\isexe\\index.js:42:5\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python D:\Python27\python.EXE

> integer@1.0.1 install D:\home\site\wwwroot\node_modules\integer
> node tools/install


D:\home\site\wwwroot\node_modules\integer>if not defined npm_config_node_gyp (node "D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
gyp verb check python version `D:\Python27\python.EXE -c "import platform; print(platform.python_version());"` returned: "2.7.8\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.9.0
gyp verb command install [ '8.9.0' ]
gyp verb install input version string "8.9.0"
gyp verb install installing version: 8.9.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.9.0
gyp verb build dir attempting to create "build" dir: D:\home\site\wwwroot\node_modules\integer\build
gyp verb build dir "build" dir needed to be created? D:\home\site\wwwroot\node_modules\integer\build
gyp verb Not using VS2017: Could not use PowerShell to find VS2017
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\home\site\wwwroot\node_modules\integer\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\home\site\wwwroot\node_modules\integer\config.gypi
gyp verb common.gypi checking for gypi file: D:\home\site\wwwroot\node_modules\integer\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn D:\Python27\python.EXE
gyp info spawn args [ 'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\home\\site\\wwwroot\\node_modules\\integer\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\local\\UserProfile\\.node-gyp\\8.9.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=D:\\local\\UserProfile\\.node-gyp\\8.9.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=D:\\local\\UserProfile\\.node-gyp\\8.9.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\home\\site\\wwwroot\\node_modules\\integer',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\home\\site\\wwwroot\\node_modules\\integer\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture ia32
gyp verb node dev dir D:\local\UserProfile\.node-gyp\8.9.0
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry 
gyp info spawn D:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=Win32' ]
gyp ERR! build error 
gyp ERR! stack Error: `D:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe" "D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\integer
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
�[37;40mnpm �[34;40mverb lifecycle integer@1.0.1~install: unsafe-perm in lifecycle true
�[37;40mnpm �[34;40mverb lifecycle integer@1.0.1~install: PATH: D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\node-gyp-bin;D:\home\site\wwwroot\node_modules\integer\node_modules\.bin;D:\home\site\wwwroot\node_modules\.bin;D:\Program Files (x86)\nodejs\8.9.0;D:\Program Files (x86)\Git\bin;D:\Program Files (x86)\nodejs\8.9.0;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Git\cmd;D:\Program Files\Microsoft Network Monitor 3\;D:\Program Files (x86)\dotnet;D:\Program Files (x86)\PHP\v5.6;D:\Python27;
�[37;40mnpm �[34;40mverb lifecycle integer@1.0.1~install: CWD: D:\home\site\wwwroot\node_modules\integer
�[37;40mnpm info lifecycle integer@1.0.1~install: Failed to exec install script
�[37;40mnpm �[34;40mverb unlock done using D:\local\Temp\monacositeextension\temp\_locks\staging-7ccd117e5dc1e199.lock for D:\home\site\wwwroot\node_modules\.staging
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 12/11/2017 6:11:30 PM.
Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win32".
Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (1) is building "D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (2) on node 1 (default targets).
D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Done Building Project "D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (default target) (1) ->
"D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (default target) (2) ->
  D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17
�[37;40mnpm �[34;40mverb stack Error: integer@1.0.1 install: `node tools/install`
�[37;40mnpm �[34;40mverb stack Exit status 1
�[37;40mnpm �[34;40mverb stack     at EventEmitter.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
�[37;40mnpm �[34;40mverb stack     at emitTwo (events.js:126:13)
�[37;40mnpm �[34;40mverb stack     at EventEmitter.emit (events.js:214:7)
�[37;40mnpm �[34;40mverb stack     at ChildProcess.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
�[37;40mnpm �[34;40mverb stack     at emitTwo (events.js:126:13)
�[37;40mnpm �[34;40mverb stack     at ChildProcess.emit (events.js:214:7)
�[37;40mnpm �[34;40mverb stack     at maybeClose (internal/child_process.js:925:16)
�[37;40mnpm �[34;40mverb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at runAction (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:74:13)
�[37;40mnpm �[34;40mverb stack     at actions.(anonymous function) (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:50:17)
�[37;40mnpm �[34;40mverb stack     at execAction (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:198:18)
�[37;40mnpm �[34;40mverb stack     at runCallback (timers.js:789:20)
�[37;40mnpm �[34;40mverb stack     at tryOnImmediate (timers.js:751:5)
�[37;40mnpm �[34;40mverb stack     at processImmediate [as _immediateCallback] (timers.js:722:5)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at withInit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:166:15)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at withInit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:182:13)
�[37;40mnpm �[34;40mverb stack     at runSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:165:10)
�[37;40mnpm �[34;40mverb stack     at doSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:146:3)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at doParallel (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:130:30)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at runSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:164:30)
�[37;40mnpm �[34;40mverb stack     at doSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:146:3)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at withInit.nodeify (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:170:5)
�[37;40mnpm �[34;40mverb pkgid integer@1.0.1
�[37;40mnpm �[34;40mverb cwd D:\home\site\wwwroot
�[37;40mnpm �[34;40mverb Windows_NT 6.2.9200
�[37;40mnpm �[34;40mverb argv "D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe" "D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\bin\\npm-cli.js" "install" "integer" "-dd"
�[37;40mnpm �[34;40mverb node v8.9.0
�[37;40mnpm �[34;40mverb npm  v5.5.1
�[37;40mnpm �[31;40mERR! code ELIFECYCLE
�[37;40mnpm �[31;40mERR! errno 1
�[37;40mnpm �[31;40mERR! integer@1.0.1 install: `node tools/install`
�[37;40mnpm �[31;40mERR! Exit status 1
�[37;40mnpm �[31;40mERR! 
�[37;40mnpm �[31;40mERR! Failed at the integer@1.0.1 install script.
�[37;40mnpm �[31;40mERR! This is probably not a problem with npm. There is likely additional logging output above.
�[37;40mnpm �[34;40mverb exit [ 1, true ]

�[37;40mnpm �[31;40mERR! A complete log of this run can be found in:
�[37;40mnpm �[31;40mERR!     D:\local\Temp\monacositeextension\temp\_logs\2017-12-11T18_11_32_508Z-debug.log

What the problem could be? How to solve? Need to install something there or upgrade version? Log file link.

2条回答
Animai°情兽
2楼-- · 2019-08-16 20:41

msbuild is failing because of a missing dependency.. some C++ runtime stuff. Just wrap it in a Dockerfile and drop it on App Service Linux, it's a simple and well-maintainable solution - https://azure.microsoft.com/en-us/services/app-service/containers/

You may also want to look into this answer if you really want to fix this "in place". This is the correct VCTargetsPath for Azure App Service (Windows workers) -

D:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

** Note this may not work at all since it's simply a shot in the dark, not the result of a thorough analysis.

查看更多
一夜七次
3楼-- · 2019-08-16 20:56

Issue with Python2 and D:\Microsoft.Cpp.Default.props was solved. Steps in Kudu (does not work in App Service Editor):

  1. npm config set msvs_version 2013
  2. npm config set python D:\Python27\python.exe
  3. SET VCTargetsPath=D:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V140

After that had another error:

d:\local\userprofile.node-gyp\8.9.0\include\node\v8.h(21): fatal error C1083: Cannot open include file: 'memory': No such file or directory [D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj

MS support said installing a nodejs module that required node-gyp build have some known issues and the only workaround for now is to run npm install on local Windows machine that has all the native module's prerequisites installed. Then, deploy the created node_modules folder as part of the application to Azure App Service (via Git or FTP).

For more info refer: Installing native nodejs modules on Azure App Services during Git Deployment

Notes from MS for future:

  • Our product group has fixed few known issues with node-gyp and there
    are couple others which they are looking into.
  • This work items is in our priority list and you should see better support for node-gyp in future releases.
查看更多
登录 后发表回答