local url=${2:-https://devcenter.heroku.com/articles/nodejs-support}
echo" ! $tip"||true
echo" $url"||true
echo""
}
warn_node_engine(){
local node_engine=${1:-}
if["$node_engine"==""];then
...
...
@@ -49,7 +57,7 @@ warn_node_engine() {
warn_prebuilt_modules(){
local build_dir=${1:-}
if[-e"$build_dir/node_modules"];then
warning "node_modules checked into source control""https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git"
warning "node_modules checked into source control""https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits"
fi
}
...
...
@@ -87,3 +95,43 @@ warn_angular_resolution() {
warning "Bower may need a resolution hint for angular""https://github.com/bower/bower/issues/1746"
fi
}
warn_missing_devdeps(){
local log_file="$1"
if grep-qi'cannot find module'"$log_file";then
warning "A module may be missing from package.json""https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
if["$NPM_CONFIG_PRODUCTION"=="true"];then
local devDeps=$(read_json "$BUILD_DIR/package.json"".devDependencies")
echo"devDependencies: $devDeps"
if["$devDeps"!=""];then
warning "A module may be specified in devDependencies instead of dependencies""https://devcenter.heroku.com/articles/nodejs-support#devdependencies"
fi
fi
fi
}
warn_no_start(){
local log_file="$1"
if![-e"$BUILD_DIR/Procfile"];then
local startScript=$(read_json "$BUILD_DIR/package.json"".scripts.start")
if["$startScript"==""];then
if![-e"$BUILD_DIR/server.js"];then
warn "This app may not specify any way to start a node process""https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type"
fi
fi
fi
}
warn_econnreset(){
local log_file="$1"
if grep-qi'econnreset'"$log_file";then
warning "ECONNRESET issues may be related to npm versions""https://github.com/npm/registry/issues/10#issuecomment-217141066"
fi
}
warn_unmet_dep(){
local log_file="$1"
if grep-qi'unmet dependency'"$log_file"||grep-qi'unmet peer dependency'"$log_file";then
warn "Unmet dependencies don't fail npm install but may cause runtime issues""https://github.com/npm/npm/issues/7494"