部署到Heroku Breaks App(Node,Yarn,Webpack 3,Angular 1.6)

时间:2017-12-07 01:27:13

标签: angularjs node.js heroku webpack yarnpkg

我一直在学习Webpack从Bower过渡。我使用Webpack(3.8.1)和Yarn(1.3.2)在NodeJS(8.9.1)上构建了一个基本的Angular(1.6.6)应用程序;但是,我得到了#34;内部服务器错误"在Heroku上运行时。但是,部署得很好,并且在localhost中完美运行。

在我的研究中,我了解到Webpack需要依赖于devDependencies。修复此问题可能会阻止其他错误,但我遇到了同样的问题。

Heroku记录责备ejs,但我怀疑这是真正的问题:

  

错误:找不到包含文件。   在includeSource(/app/node_modules/ejs/lib/ejs.js:276:17)
  at getIncludePath(/app/node_modules/ejs/lib/ejs.js:152:13)
  at /app/node_modules/ejs/lib/ejs.js:629:26
  在Array.forEach()
  在Template.generateSource(/app/node_modules/ejs/lib/ejs.js:605:15)
  在Template.compile(/app/node_modules/ejs/lib/ejs.js:509:12)
  at Object.compile(/app/node_modules/ejs/lib/ejs.js:358:16)
  在handleCache(/app/node_modules/ejs/lib/ejs.js:201:18)
  在tryHandleCache(/app/node_modules/ejs/lib/ejs.js:223:14)
  在View.exports.renderFile [作为引擎]   (/app/node_modules/ejs/lib/ejs.js:437:10)

我的package.json:

{ "name": "Simple Project",  
    "version": "0.1.0",  
    "description": "Simple Project",  
    "main": "server.js",  
    "scripts": {  
        "test": "echo \"Error: no test specified\" && exit 1",  
        "build": "webpack",  
        "start": "node server.js",  
        "postinstall": "webpack -p",  
        "heroku-prebuild": "webpack -p"  
    },  
    "repository": {  
        "type": "git",  
        "url": "git+https://github.com/Simple/Project.git"  
    },  
    "keywords": [],  
    "author": "Name",  
    "license": "MIT",  
    "bugs": {  
        "url": "https://github.com/Simple/Project/issues"  
    },  
    "homepage": "https://github.com/Simple/Project#readme",  
    "devDependencies": {  
        "babel-core": "^6.26.0",  
        "babel-loader": "^7.1.2",  
        "babel-preset-env": "^1.6.1",  
        "css-loader": "^0.28.7",  
        "extract-text-webpack-plugin": "^3.0.2",  
        "file-loader": "^1.1.5",  
        "ng-annotate-loader": "^0.6.1",  
        "node-sass": "^4.6.1",  
        "normalize.css": "^7.0.0",  
        "sass-loader": "^6.0.6",  
        "style-loader": "^0.19.0",  
        "url-loader": "^0.6.2"  
    },  
    "dependencies": {  
        "angular": "^1.6.6",  
        "angular-animate": "^1.6.6",  
        "angular-resource": "^1.6.6",  
        "angular-route": "^1.6.6",  
        "angular-ui-bootstrap": "^2.5.6",  
        "ejs": "^2.5.7",  
        "express": "^4.16.2",  
        "jquery": "^3.2.1",  
        "webpack": "^3.8.1"  
    },  
    "engines": {  
        "node": "^8.9.1",  
        "yarn": "^1.3.2"  
}} 

我已经将Webpack设置为将所有.js,供应商文件和样式放入/ dist中,即我的git中的.gitignore(d),但是在推送到Heroku时。你可以在这里查看我的git:

  

https://github.com/SalamanderMike/portfolio

我已经研究了这几天了,答案还没有透露出来。我希望有人能帮助我搞清楚。我确信这是一件我忽略的简单事情。谢谢你的帮助!

0 个答案:

没有答案