在Azure应用服务上安装npm软件包时出错 [英] Error installing npm package on Azure app service

查看:124
本文介绍了在Azure应用服务上安装npm软件包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能够在Linux和Windows 7上使用npm install成功构建better-sqlite3integer@1.0.1.但是在Azure上有问题.出现以下错误:

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.

推荐答案

Python2 D:\Microsoft.Cpp.Default.props的问题已解决. Kudu中的步骤(在App Service编辑器中不起作用):

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
  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):致命的 错误C1083:无法打开包含文件:内存":没有此类文件或 目录 [D:\ home \ site \ wwwroot \ node_modules \ integer \ build \ integer.vcxproj

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支持人员说,安装需要构建node-gyp的nodejs模块存在一些已知问题,并且是目前唯一的解决方法将在安装了所有本机模块先决条件的本地Windows计算机上运行npm install.然后,将创建的node_modules文件夹作为应用程序的一部分部署到Azure App Service(通过Git或FTP).

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).

有关更多信息,请参阅:安装Git部署期间Azure App Services上的本机nodejs模块

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

  • 我们的产品组已修复了node-gyp的一些已知问题,并在那里
    他们正在寻找的其他情侣.
  • 该工作项在我们的优先级列表中,您应该在以后的版本中看到对node-gyp的更好支持.
  • 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.

这篇关于在Azure应用服务上安装npm软件包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆