当我的代码最初加载时,我看到Chrome和Firefox中出现了奇怪的崩溃:
Uncaught TypeError: angular.module(...).constant(...).constant(...).factory(...).factory(...).factory(...).directive(...) is not a function接下来我看到一个可疑的:
ReferenceError: io is not defined in my socket factory
angular.module("xxx").factory("socket", ...)
when it attempts to access io at the line containing:
var ioSocket = io("", {
path: "/socket.io-client"
})注意:我只在运行非最小化版本的代码时才会看到这种崩溃。这个项目最初是由约曼角满叠产生的.另外,我不认为第二个错误与导入socket.io/socket.io.js有什么关系--只是第一个错误的一个工件。
注意:
grunt serve正常工作,但是
grunt serve:dist在上面展示了坠机事件。
我最初以为我有一个依赖项注入问题,所以我打开了指令ng严格di,并且能够在没有任何错误的情况下执行grunt。因此,这似乎表明了咕噜服务的失败:dist并不是一个注入问题,尽管我确实使用了许多包。
您是否可以建议对约曼设置进行一些修改,以帮助确定在构建过程中破坏代码的内容。
grunt serve:dist基本上补充如下:
concat, uglify, cssmin, and cdnigy我已经设置为“不损坏”选项: mangle:false。
我已经和这个斗争了三天了,但没有什么进展。如果你有任何想法,我会非常感激的!谢谢!
我正在运行节点v4.4.4。package.json文件是:
{
"name": "tracker2",
"version": "1.0.0",
"main": "server/app.js",
"dependencies": {
"JSONStream": "^1.1.1",
"acorn": "^3.1.0",
"assert": "^1.3.0",
"aws-sdk": "^2.3.11",
"base64-stream": "^0.1.3",
"bcryptjs": "^2.3.0",
"bluebird": "^3.3.5",
"body-parser": "^1.15.1",
"bson": "^0.4.23",
"bson-objectid": "^1.1.4",
"codemirror": "^5.14.2",
"composable-middleware": "^0.3.0",
"compression": "^1.6.2",
"connect-mongo": "^1.1.0",
"connect-multiparty": "^2.0.0",
"cookie-parser": "^1.4.1",
"ejs": "^2.4.1",
"errorhandler": "^1.4.3",
"exectimer": "^2.0.0",
"express": "^4.13.4",
"express-handlebars": "^3.0.0",
"express-jwt": "^3.4.0",
"express-session": "^1.13.0",
"extend": "^3.0.0",
"gc-stats": "https://registry.npmjs.org/gc-stats/-/gc-stats-0.0.6.tgz",
"github": "^0.2.4",
"github-api": "^1.2.1",
"heapdump": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.7.tgz",
"html2plaintext": "^1.0.1",
"htmlparser": "^1.7.7",
"htmlparser2": "^3.9.0",
"ical-generator": "^0.2.7",
"js-json": "^0.1.4",
"jsonwebtoken": "^6.2.0",
"jws": "^3.1.3",
"jwt-decode": "^2.0.1",
"lodash": "^4.12.0",
"method-override": "~2.3.3",
"mime-types": "^2.1.11",
"mocha": "^2.4.5",
"moment": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz",
"moment-timezone": "^0.5.4",
"mongodb": "^1.4.40",
"mongoose": "^4.4.14",
"mongoskin": "^1.4.13",
"monk": "^1.0.1",
"morgan": "^1.7.0",
"ng-file-upload": "^12.0.4",
"nodemailer": "^2.4.1",
"nodemailer-sendgrid-transport": "^0.2.0",
"nodemailer-sendmail-transport": "^1.0.0",
"passport": "^0.3.2",
"passport-facebook": "latest",
"passport-github": "^1.1.0",
"passport-github2": "^0.1.10",
"passport-google-oauth": "latest",
"passport-local": "~1.0.0",
"passport-twitter": "latest",
"phantomjs-prebuilt": "^2.1.7",
"q": "^1.4.1",
"random-id": "0.0.2",
"rekuire": "^0.1.9",
"request": "^2.72.0",
"serve-favicon": "^2.3.0",
"sessionstore": "^1.2.13",
"shrinkwrap": "^0.4.0",
"socket.io": "^1.4.6",
"socket.io-client": "^1.4.0",
"socketio-jwt": "^4.3.4",
"sprintf-js": "^1.0.2",
"ssl-root-cas": "^1.1.10",
"tmp": "0.0.28",
"tracer": "^0.8.3",
"uri.js": "^0.1.3",
"uuid": "^2.0.2",
"xmldom": "^0.1.22"
},
"devDependencies": {
"connect-livereload": "^0.5.4",
"grunt": "^1.0.1",
"grunt-angular-templates": "^1.0.3",
"grunt-asset-injector": "^0.1.0",
"grunt-autoprefixer": "^3.0.4",
"grunt-build-control": "DaftMonk/grunt-build-control",
"grunt-concurrent": "^2.3.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^1.0.1",
"grunt-contrib-htmlmin": "^1.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-uglify": "^1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-dom-munger": "^3.4.0",
"grunt-env": "~0.4.4",
"grunt-express-server": "^0.5.3",
"grunt-google-cdn": "~0.4.3",
"grunt-karma": "^1.0.0",
"grunt-mocha-test": "~0.12.7",
"grunt-newer": "^1.2.0",
"grunt-ng-annotate": "^2.0.2",
"grunt-node-inspector": "^0.4.1",
"grunt-nodemon": "^0.4.2",
"grunt-open": "~0.2.3",
"grunt-protractor-runner": "^3.1.0",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "^3.2.0",
"grunt-usemin": "^3.1.1",
"grunt-wiredep": "^2.0.0",
"jit-grunt": "^0.10.0",
"jshint-stylish": "^2.2.0",
"karma": "^0.13.22",
"karma-chrome-launcher": "^1.0.1",
"karma-coffee-preprocessor": "^1.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-html2js-preprocessor": "^1.0.0",
"karma-jade-preprocessor": "0.0.11",
"karma-jasmine": "^1.0.2",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-ng-jade2js-preprocessor": "^0.2.1",
"karma-ng-scenario": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-requirejs": "^1.0.0",
"karma-script-launcher": "^1.0.0",
"open": "~0.0.5",
"requirejs": "^2.2.0",
"should": "^8.3.1",
"supertest": "^1.2.0",
"time-grunt": "^1.3.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"start": "node server/app.js",
"test": "grunt test",
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules$
},
"private": true
}发布于 2016-05-16 19:56:59
这个很难找到。结果表明,如果.directive文件末尾缺少“;”分号,最小化会导致代码崩溃。我发现角时区选择器. at需要在文件末尾添加一个“;”。现在一切都如预期的那样工作!
--我希望这能帮助其他人:键:在需要时检查*.js文件以';‘结尾的所有bower components。
https://stackoverflow.com/questions/37243854
复制相似问题