我正在运行Angular 2.1.0,现在我已升级到2.4.3。我还必须将zone.js,typescript和rxjs升级到最新版本。
这就是我得到的,在此之后它就冻结了。如果我尝试使用Chrome或Firefox,则与Chrome或Firefox相同。
修改
当我用业力而不是角度cli进行测试时,我得到:
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
Error: AdminLTE requires jQuery
at src/assets/js/app_v2-3-7.js:16
但是我不明白为什么我需要添加jquery来运行我的角度测试......
karma start。\ config \ karma.conf.js
PS C:\ng\anbud> karma start .\config\karma.conf.js
17 01 2017 14:55:55.370:DEBUG [plugin]: Loading inlined plugin (defining framework:jasmine).
17 01 2017 14:55:55.374:DEBUG [plugin]: Loading inlined plugin (defining webpackPlugin, preprocessor:webpack, middleware:webpackBlocker).
17 01 2017 14:55:55.375:DEBUG [plugin]: Loading inlined plugin (defining reporter:karma-remap-istanbul).
17 01 2017 14:55:55.375:DEBUG [plugin]: Loading inlined plugin (defining launcher:Chrome, launcher:ChromeCanary, launcher:Chromium, launcher:Dartium, test).
17 01 2017 14:55:55.376:DEBUG [plugin]: Loading inlined plugin (defining launcher:Firefox, launcher:FirefoxDeveloper, launcher:FirefoxAurora, launcher:FirefoxNightly).
17 01 2017 14:55:55.376:DEBUG [plugin]: Loading inlined plugin (defining launcher:PhantomJS).
17 01 2017 14:55:55.377:DEBUG [plugin]: Loading inlined plugin (defining reporter:mocha).
17 01 2017 14:55:55.377:DEBUG [plugin]: Loading inlined plugin (defining framework:angular-cli, preprocessor:angular-cli, webpackPlugin, preprocessor:webpack, middleware:webpackB
17 01 2017 14:55:55.402:DEBUG [web-server]: Instantiating middleware
17 01 2017 14:55:55.403:DEBUG [reporter]: Trying to load reporter: mocha
17 01 2017 14:55:55.406:DEBUG [reporter]: Trying to load color-version of reporter: mocha (mocha_color)
17 01 2017 14:55:55.406:DEBUG [reporter]: Couldn't load color-version.
17 01 2017 14:55:55.407:DEBUG [reporter]: Trying to load reporter: karma-remap-istanbul
17 01 2017 14:55:55.408:DEBUG [reporter]: Trying to load color-version of reporter: karma-remap-istanbul (karma-remap-istanbul_color)
17 01 2017 14:55:55.409:DEBUG [reporter]: Couldn't load color-version.
START:
17 01 2017 14:56:07.671:DEBUG [preprocessor.sourcemap]: base64-encoded source map for C:/ng/anbud/src/test.ts
17 01 2017 14:56:07.699:INFO [karma]: Karma v1.4.0 server started at http://0.0.0.0:9876/
17 01 2017 14:56:07.700:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
17 01 2017 14:56:07.795:INFO [launcher]: Starting browser PhantomJS
17 01 2017 14:56:07.796:DEBUG [temp-dir]: Creating temp dir at C:\Users\js\AppData\Local\Temp\karma-67200268
17 01 2017 14:56:07.802:DEBUG [launcher]: C:\ng\anbud\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe C:\Users\js\AppData\Local\Temp\karma-67200268/capture.js
17 01 2017 14:56:09.663:DEBUG [web-server]: serving: C:\Users\js\AppData\Roaming\npm\node_modules\karma\static/client.html
17 01 2017 14:56:10.005:DEBUG [web-server]: serving: C:\Users\js\AppData\Roaming\npm\node_modules\karma\static/karma.js
17 01 2017 14:56:10.035:DEBUG [karma]: A browser has connected on socket K-tWz9YDHvcFZAz1AAAA
17 01 2017 14:56:11.053:DEBUG [web-server]: upgrade /socket.io/?EIO=3&transport=websocket&sid=K-tWz9YDHvcFZAz1AAAA
17 01 2017 14:56:11.055:DEBUG [proxy]: NOT upgrading proxyWebSocketRequest /socket.io/?EIO=3&transport=websocket&sid=K-tWz9YDHvcFZAz1AAAA
17 01 2017 14:56:11.219:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket K-tWz9YDHvcFZAz1AAAA with id 67200268
17 01 2017 14:56:11.220:DEBUG [launcher]: PhantomJS (id 67200268) captured in 3.519 secs
17 01 2017 14:56:11.226:DEBUG [phantomjs.launcher]:
17 01 2017 14:56:11.228:DEBUG [middleware:karma]: custom files null null
17 01 2017 14:56:11.231:DEBUG [middleware:karma]: Serving static request /context.html
17 01 2017 14:56:11.243:DEBUG [web-server]: serving: C:\Users\js\AppData\Roaming\npm\node_modules\karma\static/context.html
17 01 2017 14:56:11.251:DEBUG [web-server]: serving: C:\Users\js\AppData\Roaming\npm\node_modules\karma\static/context.js
17 01 2017 14:56:11.259:DEBUG [middleware:source-files]: Requesting /base/src/assets/js/app_v2-3-7.js?7af00385e170b4f98cd7f62a83edaf8952e961be /
17 01 2017 14:56:11.259:DEBUG [middleware:source-files]: Fetching C:/ng/anbud/src/assets/js/app_v2-3-7.js
17 01 2017 14:56:11.261:DEBUG [web-server]: serving (cached): C:/ng/anbud/src/assets/js/app_v2-3-7.js
17 01 2017 14:56:11.262:DEBUG [middleware:source-files]: Requesting /base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?391e45351df9ee35392d2e5cb623221a969fc009 /
17 01 2017 14:56:11.266:DEBUG [middleware:source-files]: Fetching C:/ng/anbud/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
17 01 2017 14:56:11.267:DEBUG [web-server]: serving (cached): C:/ng/anbud/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
17 01 2017 14:56:11.290:DEBUG [middleware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/boot.js?945a38bf4e45ad2770eb94868231905a04a0bd3e /
17 01 2017 14:56:11.290:DEBUG [middleware:source-files]: Fetching C:/ng/anbud/node_modules/karma-jasmine/lib/boot.js
17 01 2017 14:56:11.291:DEBUG [web-server]: serving (cached): C:/ng/anbud/node_modules/karma-jasmine/lib/boot.js
17 01 2017 14:56:11.295:DEBUG [middleware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/adapter.js?7a813cc290d592e664331c573a1a796192cdd1ad /
17 01 2017 14:56:11.296:DEBUG [middleware:source-files]: Fetching C:/ng/anbud/node_modules/karma-jasmine/lib/adapter.js
17 01 2017 14:56:11.298:DEBUG [middleware:source-files]: Requesting /base/src/test.ts?1fe06d4942a6e689b80209f67e81995416c12d34 /
17 01 2017 14:56:11.298:DEBUG [middleware:source-files]: Fetching C:/ng/anbud/src/test.ts
17 01 2017 14:56:11.303:DEBUG [web-server]: serving (cached): C:/ng/anbud/node_modules/karma-jasmine/lib/adapter.js
17 01 2017 14:56:11.303:DEBUG [web-server]: serving (cached): C:/ng/anbud/src/test.ts
17 01 2017 14:56:11.343:DEBUG [phantomjs.launcher]: Error: AdminLTE requires jQuery
http://localhost:9876/base/src/assets/js/app_v2-3-7.js?7af00385e170b4f98cd7f62a83edaf8952e961be:16 in global code
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
Error: AdminLTE requires jQuery
at src/assets/js/app_v2-3-7.js:16
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
Error: AdminLTE requires jQuery
at src/assets/js/app_v2-3-7.js:16
Finished in 0.131 secs / 0 secs
SUMMARY:
√ 0 tests completed
17 01 2017 14:56:11.360:DEBUG [reporter.remap-istanbul]: Writing coverage to coverage
17 01 2017 14:56:11.361:DEBUG [reporter.remap-istanbul]: Writing coverage to ./coverage/coverage.lcov
17 01 2017 14:56:11.363:DEBUG [karma]: Run complete, exiting.
17 01 2017 14:56:11.366:DEBUG [launcher]: Disconnecting all browsers
17 01 2017 14:56:11.965:DEBUG [launcher]: Process PhantomJS exited with code 0
17 01 2017 14:56:11.965:DEBUG [temp-dir]: Cleaning temp dir C:\Users\js\AppData\Local\Temp\karma-67200268
17 01 2017 14:56:11.977:DEBUG [launcher]: Finished all browsers
PS C:\ng\anbud> PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
知道如何让它再次发挥作用吗?
由于
的package.json
{
"name": "beskrivelse",
"version": "0.1.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng server",
"postinstall": "typings install",
"lint": "tslint \"src/**/*.ts\"",
"format": "clang-format -i -style=file --glob=src/**/*.ts",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"clean": "rm -rf dist",
"translate": "node_modules/.bin/ng-xi18n -p src/tsconfig.json ",
"ngc": "node_modules/.bin/ngc -p src/tsconfig-aot.json --i18nFile=./locale/messages.no.xlf --locale=no --i18nFormat=xlf "
},
"private": true,
"dependencies": {
"@angular/common": "2.4.3",
"@angular/compiler": "2.4.3",
"@angular/compiler-cli": "2.4.3",
"@angular/core": "2.4.3",
"@angular/forms": "2.4.3",
"@angular/http": "2.4.3",
"@angular/platform-browser": "2.4.3",
"@angular/platform-browser-dynamic": "2.4.3",
"@angular/platform-server": "2.4.3",
"@angular/router": "3.0.0",
"angular2-jwt": "0.1.23",
"core-js": "2.4.1",
"ng2-cookies": "1.0.1",
"rxjs": "5.0.3",
"sweetalert2": "4.0.10",
"ts-helpers": "^1.1.1",
"ts-md5": "^1.2.0",
"zone.js": "0.7.5"
},
"devDependencies": {
"@types/jasmine": "2.2.30",
"@types/protractor": "1.5.16",
"angular-cli": "1.0.0-beta.25.5",
"codelyzer": "0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.4.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "1.1.0",
"karma-mocha": "1.1.1",
"karma-mocha-reporter": "2.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-remap-istanbul": "0.4.0",
"mocha": "3.0.2",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.1.5"
},
"description": "This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.11-webpack.",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://jsviland@bitbucket.org/me123456/angular2.git"
},
"author": "",
"homepage": "https://bitbucket.org/me123456/angular2#readme"
}
karma.conf.js
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-webpack'),
require('karma-remap-istanbul'),
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
require('karma-phantomjs-launcher'),
require('karma-mocha-reporter'),
require('angular-cli/plugins/karma'),
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
// './src/test.ts': ['angular-cli', 'sourcemap']
'./src/test.ts': ['angular-cli']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: ['mocha', 'karma-remap-istanbul'],
client: {
captureConsole: false,
/*
mocha: {
bail: true
}
*/
},
/*
webpack: {
devtool: 'inline-source-map'
},
*/
port: 9876,
colors: true,
/*
config.LOG_DISABLE
config.LOG_ERROR
config.LOG_WARN
config.LOG_INFO
config.LOG_DEBUG
*/
logLevel: config.LOG_DEBUG,
autoWatch: false,
browserNoActivityTimeout: 60000,
browsers: ['PhantomJS'],
// browsers: ['Chrome'],
// browsers: ['Firefox'],
singleRun: true
});
};
答案 0 :(得分:1)
],
"scripts": [
"assets/js/jquery-2.2.4.min.js",
"assets/js/bootstrap-3.3.6.min.js",
"assets/js/raven-3.7.0.min.js",
"assets/js/app_v2-3-7.js"
],
通过添加我的jquery脚本yo angular-cli.json
来修复它