Ich versuche, eine NodeJS-App auf AWS CodeDeploy bereitzustellen, und ein Problem mit Gulp Abhängigkeiten und Npm Install/Start von einer Bash-Datei ausführen.NodeJS App-Bereitstellung - NPM/Gulp
Ich habe eine Standard-App-Ordner-Struktur, mit package.json in der Projektwurzel usw.
Bash-Datei (ist/npm_install.sh)
cd /opt/deployments/app-backend
npm install
NPM Skript Definitionen
"scripts": {
"postinstall": "gulp minify-sdk && gulp setup-auto",
"start": "gulp",
"test": "gulp test"
}
Fehler beim Ausführen von bin/npm_install.s h
[stdout]
[stdout]> [email protected] start /opt/deployments/app-backend
[stdout]> gulp
[stdout]
[stderr]
[stderr]module.js:340
[stderr] throw err;
[stderr] ^
[stderr]Error: Cannot find module 'pretty-hrtime'
[stderr] at Function.Module._resolveFilename (module.js:338:15)
[stderr] at Function.Module._load (module.js:280:25)
[stderr] at Module.require (module.js:364:17)
[stderr] at require (module.js:380:17)
[stderr] at Object.<anonymous> (/opt/deployments/app-backend/node_modules/.bin/gulp:5:18)
[stderr] at Module._compile (module.js:456:26)
[stderr] at Object.Module._extensions..js (module.js:474:10)
[stderr] at Module.load (module.js:356:32)
[stderr] at Function.Module._load (module.js:312:12)
[stderr] at Function.Module.runMain (module.js:497:10)
[stderr]npm ERR! weird error 8
[stderr]npm WARN This failure might be due to the use of legacy binary "node"
[stderr]npm WARN For further explanations, please read
[stderr]/usr/share/doc/nodejs/README.Debian
[stderr]
[stderr]npm ERR! not ok code 0
ANMERKUNG: Die Ausführung npm Arbeiten installiert fein aus dem Projektstammordner.
Irgendwelche Vorschläge? Ist dies der beste Weg, die App zu starten, nachdem CodeDeploy die Bereitstellung des Codes abgeschlossen hat?
Siehe meine Antwort für eine Erklärung, was passiert ist. – Seonixx