Azure Website: Kudu fails to install - node.js

I started to run into this problem yesterday. Deploys fail when I run:
npm install kudusync -g
with the following error:
Error: SSL Error: CERT_UNTRUSTED
From some searches it appears that one of Kudu's dependencies is self-signed or unsigned. It seems like I can disable SSL checks for Node -- but that seems like a dangerous option and not recommended. Is anyone aware of any other workarounds?
The output in azure is as follows:
remote: npm http GET https://registry.npmjs.org/kudusync[K
remote: ......[K
remote: npm http GET https://registry.npmjs.org/kudusync[K
remote: .......................................................[K
remote: npm http GET https://registry.npmjs.org/kudusync[K
remote: npm ERR! Error: SSL Error: CERT_UNTRUSTED[K
remote: npm ERR! at ClientRequest. (d:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\main.js:440:26)[K
remote: An error has occurred during web site deployment.[K

The break most likely refers to this change npm made.
Do you have a custom deployment script, or the standard script? With custom, your options are:
use a newer version of npm
run npm config set strict-ssl false before running npm
if your custom script has a reference to KUDU_SYNC_COMMAND, rename that to KUDU_SYNC_CMD

Related

Problems when deploying MERN stack app in Heroku

What is the solution to this problem? I'm getting this error while trying to deploy a MERN stack in Heroku. What I did is: I configured MONGO_URI, PORT, etc. Pushed all working code in Github still getting this error. What should I do to be able to deploy this app successfully? I tried deploying the application by reading Heroku documentation and watching youtube tutorial.
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 14.16.1
engines.npm (package.json): 6.14.12
Resolving node version 14.16.1...
Downloading and installing node 14.16.1...
npm 6.14.12 already installed with node
-----> Installing dependencies
Installing node modules
> nodemon#2.0.7 postinstall /tmp/build_5044977d/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
> bcrypt#5.0.1 install /tmp/build_5044977d/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/tmp/build_5044977d/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
added 365 packages in 9.194s
-----> Build
Running heroku-postbuild
> car-app#1.0.0 heroku-postbuild /tmp/build_5044977d
> NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend
up to date in 0.234s
found 0 vulnerabilities
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /tmp/build_5044977d/frontend/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_5044977d/frontend/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GU88T/_logs/2021-07-02T10_17_10_423Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 254
npm ERR! car-app#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend`
npm ERR! Exit status 254
npm ERR!
npm ERR! Failed at the car-app#1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.GU88T/_logs/2021-07-02T10_17_10_446Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
if it is heroku postbuild issue then first run
npm run build
in your local system inside client folder(frontend application), it will throw an error if some dependency is missing inside your react app,
if build command is successful only then delete node_modules and package-lock.json file and then run
npm install

HEROKU : node-pre-gyp install --fallback-to-build

I had this problem since I used #discordjs/opus, I saw a big bunch of similar problems everywhere, and nothing helped me changing this error. It always concern node-pre-gyp. I first tried to put it manually in my package.json, and the build suceeded, but there was no sound siplayed, and a lot of warning messages in the build log... Also some people had issues with bcrypt, but it wasn't the case here...
Thanks for your help!
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.4...
Using default npm version: 6.14.6
-----> Restoring cache
- node_modules is checked into source control and cannot be cached
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> #discordjs/opus#0.3.2 install /tmp/build_2510a47a_/node_modules/#discordjs/opus
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! #discordjs/opus#0.3.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the #discordjs/opus#0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.N30Iz/_logs/2020-09-28T09_36_00_646Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed`
Well, as JM-AGMS said, the solution was to make visible package lock, type the node engine in the package, and remove the node modules folder in order to have a succeeded build.
However, the error about node pre-gyp is still there.

Jenkins deployment

I am getting the below mentioned error when i am trying to build my app through Jenkins.
remote: npm ERR! code EINTEGRITY
remote: npm ERR! sha512-d7r5njiOKUND9m1FbjCtIzYGUD7hl9sdyvbH3OsDqR3aW+XB7qmZPQ+uQWBNYh+h8Zm9G6e2eDJjx0evOTe9xQ== integrity checksum failed when using sha512: wanted sha512-d7r5njiOKUND9m1FbjCtIzYGUD7hl9sdyvbH3OsDqR3aW+XB7qmZPQ+uQWBNYh+h8Zm9G6e2eDJjx0evOTe9xQ== but got sha512-gXvGMnj54hIhBsUUrFBgXzhCe84xaGpMACqvW4ViF4j0n2xXO+IwWPPkal17FUvVrzd82sXqFAWDGXdasEFGrw==. (1163 bytes)
How to solve this issue?
Thanks
I'm having this problem as well (angular 7 npm 5.6). When I manually run npm install on our CI server, everything is fine. When Jenkins builds automatically on the the same server, I get the EINTEGRITY error.

Azure Web App node.js deployment failure

I am trying to deploy a node.js application as Web App via git continuous deployment. The deployment fails with errors like below
remote: npm ERR! fetch failed https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz
remote: npm ERR! fetch failed https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz
remote: npm ERR! fetch failed https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz
remote: npm ERR! fetch failed https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz
remote: npm ERR! fetch failed https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.1.tgz
Any one know whats causing this ?
Are you using any systems that could be affected by the DDoS attack today? I also have had deploy errors today because of these attacks. I am using a combination of GitHub, Heroku, and Codeship, and I am sure Azure being a microsoft product / US based could also be experiencing problems.
http://www.cnbc.com/2016/10/21/major-websites-across-east-coast-knocked-out-in-apparent-ddos-attack.html

Installing Node.js modules from file system on Azure Websites

I have a Node.js app running as an Azure Website and doing my deployments using Git. The app requires a module that's private (i.e. written by me, no relevance to anyone else and thus not available in NPM) and common to my other projects. Let's say the module is located in ./lib/mymodule and it has its own dependencies in its package.json file. The problem is I cannot figure out how to have Azure install the dependencies of my own module. I would like to avoid having to add my node_modules directory under version control (currently .gitignor'd) or having to add the module's dependencies as my app's dependencies (which is ugly and a bit inconvenient).
It's trivial to get this working on my local dev environment. The first thing I did was simply include my own module as a local dependency in my package.json as described in https://docs.npmjs.com/files/package.json (see section "Local Paths"). A simple npm install would now install my own module nice and easy. Since I know that Azure runs npm install every time I deploy a new version, I figured this is all I need. Turns out I was wrong: local paths in package.json dependencies section were only introduced in NPM 2.0.0 and Azure is running NPM 1.4.x, so the deployment obviously failed. Ok then, can I run a different version of NPM in Azure? In theory, yes, but practice seems to be something else. I tried out https://github.com/glennblock/azure-node-runtime-selector but to no avail. Here's some of the deployment output:
remote: Handling node.js deployment.
remote: KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
remote: ............
remote: node version: 0.11.14
remote: ..............
remote: 2.1.18
remote: npm version: 1.4.6
remote: An error has occured during web site deployment.
remote: npm failed
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
Apparently it fails to install any NPM version >= 2.0.0.
Ok then, this is not so bad, I figured. I can work with an older version of NPM, I just need to run another npm install to install my own module, as NPM documentation hints. So I took the local dependency away from my package.json and simply run npm install ./lib/mymodule. Nice and easy... on my local. I dug up instructions how to run custom commands on deployment in Azure: just run azure site deploymentscript --node and edit deploy.sh it creates. Just to ensure the custom deployment script works at all, I made one deployment without editing anything. Worked ok. Then I added a line in deploy.sh (around line 111):
# 3. Install npm packages
if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then
cd "$DEPLOYMENT_TARGET"
eval $NPM_CMD install --production
eval $NPM_CMD install ./lib/mymodule #This line added by me
exitWithMessageOnError "npm failed"
cd - > /dev/null
fi
Nope. This is what I get:
remote: Installing npm packages...
remote: npm ERR! addLocal Could not install ./lib/mymodule
remote: An error has occurred during web site deployment.
remote: npm ERR! Error: ENOENT, stat 'd:\home\site\wwwroot\lib\mymodule'
remote: npm failed
...snip...
remote:
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "d:\\Program Files (x86)\\nodejs\\0.10.28\\node.exe" "D:\\Program Files(x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install" "./lib/mymodule"
remote: npm ERR! cwd d:\home\site\wwwroot
remote: npm ERR! node -v v0.10.28
remote: npm ERR! npm -v 1.4.9
remote: npm ERR! path d:\home\site\wwwroot\lib\mymodule
remote: npm ERR! code ENOENT
remote: npm ERR! errno 34
remote: npm
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
This is where I got stuck. I tried playing around with the path, guessing that Windows is mangling it somehow, but haven't found a working solution yet. The weird thing is that ./lib/mymodule would seem to resolve to d:\home\site\wwwroot\lib\mymodule which look just fine to me and DOES exist, at least after deployment when I FTP'd in to take a look.
I would appreciate any and all help in either getting NPM 2.x.x working or my making custom deployment go through. Or maybe there's an alternative to managing my local modules I haven't thought of? And if all else fails, maybe I'll just commit my node_modules or manage my dependencies manually. I've already used way too much time to resolve what first seemed like a trivial issue. :)
Azure WebSites team will be shipping support for npm 2.1.17 out-of-the box by end of the month (Jan'15). Hope this will help you unblock you.

Resources