Unable to install StackImpact on Azure Web App - node.js

I am unable to install the NodeJs perf monitor "StackImpact" on either of my Azure Web Apps (Windows based running Kudu). It all works fine locally on my Windows 10 laptop but NPM install fails on the servers (output below)
I've tried upgrading to Node 10.6 (latest version Azure supports), then downgrading back to Node 8.11.1. I double checked that the machines are running in 64bit.
...
89 verbose stack Error: stackimpact#1.3.10 install: `node node-gyp-fallback.js`
89 verbose stack Exit status 1
89 verbose stack at EventEmitter.<anonymous> (D:\Program Files (x86)\npm\6.1.0\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
89 verbose stack at EventEmitter.emit (events.js:182:13)
89 verbose stack at ChildProcess.<anonymous> (D:\Program Files (x86)\npm\6.1.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
89 verbose stack at ChildProcess.emit (events.js:182:13)
89 verbose stack at maybeClose (internal/child_process.js:961:16)
89 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
90 verbose pkgid stackimpact#1.3.10
91 verbose cwd D:\home\site\wwwroot
92 verbose Windows_NT 10.0.14393
93 verbose argv "D:\\Program Files (x86)\\nodejs\\10.6.0\\node.exe" "D:\\Program Files (x86)\\npm\\6.1.0\\node_modules\\npm\\bin\\npm-cli.js" "install" "stackimpact"
94 verbose node v10.6.0
95 verbose npm v6.1.0
96 error code ELIFECYCLE
97 error errno 1
98 error stackimpact#1.3.10 install: `node node-gyp-fallback.js`
98 error Exit status 1
99 error Failed at the stackimpact#1.3.10 install script.
99 error This is probably not a problem with npm. There is likely additional logging output above.
100 verbose exit [ 1, true ]
Any help would be greatly appreciated!

soutarm. I reproduce your issue on my side.
According to my observation, it has nothing to do with node version or npm version. It said node-gyp not found.
So, I followed this case to run the command npm install -global node-gyp. You could check it under the D:\local\AppData\npm>.
As we know, node-gyp needs to rely on python2.7 and Microsoft's vc++ build tools for compilation, this is fine on Linux systems because Linux is installed by default, but the Windows operating system does not install python2.7 and vc++ Build tool by default.
I tried to install that npm install --global --production windows-build-tools but failed. It needs admin permission which is can't be touched by us in web app sandbox restrictions.
So,as workaround, maybe you have to install the packages locally then upload total node_modules folder to azure instead of installing packages in kudu.
Addition:
Azure support pointed out that the package only runs in 64 bit environments while their Web Apps run x86 Node by default, even if you've set the environment to x64.
You can override by manually copying x64 Node to the server, updating iisnode.yml to point to it then manually updating node_modules. All of which totally destroys any chance of a clean CI path.

Related

Git bash doesn't execute npm install

I keep getting this error in Git Bash when trying to do an npm install:
64 verbose stack Error: command failed
64 verbose stack at ChildProcess.<anonymous> (C:\Users\baseuser\AppData\Roaming\npm\node_modules\npm\node_modules\#npmcli\promise-spawn\index.js:64:27)
64 verbose stack at ChildProcess.emit (events.js:400:28)
64 verbose stack at maybeClose (internal/child_process.js:1058:16)
64 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
65 verbose pkgid app-backend#1.0.1-dev.0
66 verbose cwd C:\work\gitrepo\app-backend
67 verbose Windows_NT 10.0.18363
68 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\baseuser\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
69 verbose node v14.18.0
70 verbose npm v8.0.0
71 error code 1
72 error path C:\work\gitrepo\app-backend
73 error command failed
74 error command C:\windows\system32\cmd.exe /d /s /c npm run build
75 verbose exit 1
I have node and npm installed globally and npm install works in Powershell or Windows Command line, but not in Git Bash for some reason. I have them added to PATH variable. I done npm clear cache -force but nothing changed.
Removed node, npm, git with git bash and reinstalled them againt, and the error still present.
this issue happened recently to many ppl earlier in the last 2 weeks , it seems like a problem withh package distrepution .
To fix this try cloning your library to different location . going into the packages/dscc-scripts directory and running the build command. You can then point all of the scripts from the package.json dscc-gen made to the packages/dscc-scripts/index.js file. Bit of a hack, but good for the quick fix.

node-gyp rebuild issue compiler

This issue doesn't seem to be the case with all of my projects, one in particular gives this issue when I run npm i (node v6.9.4 (npm v5.6.0) <- also not sure if this is right):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:25:11: fatal error:
'pthread.h' file not found
# include <pthread.h>
The error log:
12788 verbose stack Error: farmhash#1.2.1 install: `node-gyp rebuild`
12788 verbose stack Exit status 1
12788 verbose stack at EventEmitter.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at EventEmitter.emit (events.js:191:7)
12788 verbose stack at ChildProcess.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at ChildProcess.emit (events.js:191:7)
12788 verbose stack at maybeClose (internal/child_process.js:877:16)
12788 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
12789 verbose pkgid farmhash#1.2.1
12790 verbose cwd /Users/tom.firth/Sites/the-works
12791 verbose Darwin 16.7.0
12792 verbose argv "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/node" "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/npm" "i"
12793 verbose node v6.9.4
12794 verbose npm v5.6.0
12795 error code ELIFECYCLE
12796 error errno 1
12797 error farmhash#1.2.1 install: `node-gyp rebuild`
12797 error Exit status 1
12798 error Failed at the farmhash#1.2.1 install script.
12798 error This is probably not a problem with npm. There is likely additional logging output above.
12799 verbose exit [ 1, true ]
Both of these point to node-gyp rebuild - I haven't had this installed globally before, but i've tried it with and without and get the same error.
I have xcode 9.1 installed and ran:
$ xcode-select --install
which gives: xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I followed the steps in: npmjs.com/fixing-npm-permissions
$ gcc --version
which gives:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ which gcc
which gives:
/usr/bin/gcc
The node-gyp issue makes me think it's related to the compiler but I have reinstalled xcode and node (via brew and nodejs.org)
Any help or suggestions would be really appreciated.
edit:
I have tried npm 3.10.10 because 5.6.0 obviously wasn't right. This was previously installed and didn't resolve the issue.
I installed xcode 8.2.1 to replace xcode 9.1, this didn't resolve the issue.
You basically need to install libtool to make it work. This was same issue I had when I was using bcrypt. If that doesn't seems to work you should have a look at this.
Also please check which version of python is installed supported version is 2.7 the latest 3.x is not supported yet as per node-gyp documentation. This node Js Workshop discuss more details about the gyp this should be of some help too.
I'm not entirely sure what the solution was.
I installed xcode 8.2.1 (down from 9.1). I had tried this before but
Initially this didn't work.
I then installed the commandlinetools manually (not via
xcode-select --install) (Library/Developer/CommandLineTools
didn't exist before or after this installation) - xcode-select -p
changed its path from pointing to xcode to commandlinetools even
though the dir didn't exist.
I then installed Xcode8.2.1 again, xcode-select's path automatically
changed without a reset (xcode-select --reset)
After this, my issue was resolved.

npm ERR! Invalid name: "#types/handlebars"

I was trying to install typedoc with npm, however seeing the following error:
npm ERR! Invalid name: "#types/handlebars"
I then tried to install #types/handlebars directly by:
npm install #types/handlebars
And the same error message shows up again. When I try to view package info by running:
npm info #types/handlebars
I can see the info correctly. What else should I check to tackle the problem?
I am using node v4.8.3 and npm v2.15.11 on OSX 10.10.5.
Here are the stack trace from npm-debug.log:
58 verbose etag https://registry.npmjs.org/#types%2fhandlebars from cache
59 verbose get saving #types/handlebars to /Users/ycchen/.npm/registry.npmjs.org/_40types_252fhandlebars/.cache.json
60 verbose correctMkdir /Users/ycchen/.npm correctMkdir not in flight; initializing
61 silly addNameTag next cb for #types/handlebars with tag latest
62 silly addNamed #types/handlebars#4.0.33
63 verbose addNamed "4.0.33" is a plain semver version for #types/handlebars
64 verbose stack Error: Invalid name: "#types/handlebars"
64 verbose stack at ensureValidName (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:297:15)
64 verbose stack at Object.module.exports.fixNameField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:201:5)
64 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:38
64 verbose stack at Array.forEach (native)
64 verbose stack at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:28:15)
64 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:349:5)
64 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
64 verbose stack at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:295:20)
64 verbose stack at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
64 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)
I suspect this has to do with where it is actually getting the types from. The info command works since it must be looking at official npm registry.
To try it out you can override the registry for specific scopes (#types in this case). For example:
npm config set #types:registry https://registry.npmjs.org/
This tells npm to always get anything for the #types scope directly from the official registry.
EDIT: I see from your edited question that npm does try to get it from the official registry so you might wish to get the latest npm since the version you are using is quite dated. You can do so by:
sudo npm cache clean
sudo npm install npm -g

Kurento OneToMany With Rooms

I look at this link
https://github.com/BitOfUniverse/kurento-one2many-with-rooms/issues/1
and decided to run on my local machine via VMvare on Ubuntu Server 14.04 TLS
Before start to run this,
I install KMS 6 on ubuntu via this referance page.
doc-kurento.readthedocs.io/en/stable/installation_guide.html#migrating-from-kms-v5-to-v6
After KMS install, I follow the this link at below as referance
doc-kurento.readthedocs.io/en/stable/tutorials/node/tutorial-one2many.html
My installation step for this link a little different
Here is the my installation steps:
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g bower
After this step
I follow these
git clone https://github.com/BitOfUniverse/kurento-one2many-with-rooms.git
cd kurento-tutorial-node/kurento-one2many-call
git checkout 6.6.0
npm install
At there I used your git adress: git clone https://github.com/BitOfUniverse/kurento-one2many-with-rooms.git
Until these steps everthing looks fine. But when I run this command
npm start
I get the following error on log file
0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node',
'/usr/bin/npm', 'start' ] 2 info using npm#2.15.1 3 info using
node#v0.10.48 4 verbose node symlink /usr/bin/node 5 verbose
run-script [ 'prestart', 'start', 'poststart' ] 6 info prestart
kurento-one2many-call#6.2.2-dev 7 info start
kurento-one2many-call#6.2.2-dev 8 verbose unsafe-perm in lifecycle
true 9 info kurento-one2many-call#6.2.2-dev Failed to exec start
script 10 verbose stack Error: kurento-one2many-call#6.2.2-dev start:
node server.js 10 verbose stack Exit status 8 10 verbose stack at
EventEmitter.
(/usr/lib/node_modules/npm/lib/utils/lifecycle.js:217:16) 10 verbose
stack at EventEmitter.emit (events.js:98:17) 10 verbose stack at
ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14) 10
verbose stack at ChildProcess.emit (events.js:98:17) 10 verbose stack
at maybeClose (child_process.js:766:16) 10 verbose stack at
Process.ChildProcess._handle.onexit (child_process.js:833:5) 11
verbose pkgid kurento-one2many-call#6.2.2-dev 12 verbose cwd
/home/can/kurento-one2many-with-rooms 13 error Linux 4.4.0-31-generic
14 error argv "/usr/bin/node" "/usr/bin/npm" "start" 15 error node
v0.10.48 16 error npm v2.15.1 17 error code ELIFECYCLE 18 error
kurento-one2many-call#6.2.2-dev start: node server.js 18 error Exit
status 8 19 error Failed at the kurento-one2many-call#6.2.2-dev start
script 'node server.js'. 19 error This is most likely a problem with
the kurento-one2many-call package, 19 error not with npm itself. 19
error Tell the author that this fails on your system: 19 error node
server.js 19 error You can get information on how to open an issue for
this project with: 19 error npm bugs kurento-one2many-call 19 error Or
if that isn't available, you can get their info via: 19 error 19 error
npm owner ls kurento-one2many-call 19 error There is likely additional
logging output above. 20 verbose exit [ 1, true ]
My question is that, What Am I wrong? When I try to run example on Kurento, there isn't any error. But at there I get these error.
Also, I try to install socket.Io and etc. when I get error, but not solve my problem.
I found on the internet that 8080 port problem and kill apps on this port on cmd but still I have error.
What can I do? If you help me, I will be very happy.
Thaks a lot of your answer, have a nice and hapy day :) :) :)
Best Rigards
There is a postinstall script you need to run after building the project (npm run postinstall). On lines 34 & 35 of project readFileSync uses relative path which doesn't work. You can fix that with path.join or simply hardcode full path. Also file names used for SSL keys are different from the ones on github and should be changed.
After all you may build the project but it doesn't work. Here is a refined fork.

npm install, node-gyp rebuild error

I'm just starting out working with node.js and when I try npm install I get an error stating Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'. After extensive googling I still have not found the problem.
Here's the error log:
Error Log
313 verbose stack Error: bcrypt#0.8.5 install: `node-gyp rebuild`
313 verbose stack Exit status 1
313 verbose stack at EventEmitter.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:239:16)
313 verbose stack at emitTwo (events.js:100:13)
313 verbose stack at EventEmitter.emit (events.js:185:7)
313 verbose stack at ChildProcess.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
313 verbose stack at emitTwo (events.js:100:13)
313 verbose stack at ChildProcess.emit (events.js:185:7)
313 verbose stack at maybeClose (internal/child_process.js:827:16)
313 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
314 verbose pkgid bcrypt#0.8.5
315 verbose cwd D:\Werk\W12C\we12c\W12C
316 error Windows_NT 6.1.7601
317 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Apparaat1\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
318 error node v5.7.0
319 error npm v3.7.3
320 error code ELIFECYCLE
321 error bcrypt#0.8.5 install: `node-gyp rebuild`
321 error Exit status 1
322 error Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'.
322 error Make sure you have the latest version of node.js and npm installed.
322 error If you do, this is most likely a problem with the bcrypt package,
322 error not with npm itself.
322 error Tell the author that this fails on your system:
322 error node-gyp rebuild
322 error You can get information on how to open an issue for this project with:
322 error npm bugs bcrypt
322 error Or if that isn't available, you can get their info via:
322 error npm owner ls bcrypt
322 error There is likely additional logging output above.
323 verbose exit [ 1, true ]
Versions:
node -v
v5.7.0
npm -v
3.7.3
May be it's a little bit late but the solution in node-gyp
https://github.com/nodejs/node-gyp#installation
There are 2
different options.
Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
Option 2: Install tools and configuration manually:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install option.
Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)
Launch cmd, npm config set msvs_version 2015
If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.
[Windows Vista / 7 only] requires .NET Framework 4.5.1

Resources