Skip to content

npm run unit 单元测试失败 #154

Closed
@luxueyan

Description

@luxueyan
23 08 2016 19:29:51.327:WARN [karma]: Port 9876 in use
23 08 2016 19:29:51.329:INFO [karma]: Karma v0.13.22 server started at http://localhost:9877/
23 08 2016 19:29:51.333:INFO [launcher]: Starting browser PhantomJS
23 08 2016 19:29:51.336:ERROR [launcher]: No binary for PhantomJS browser on your platform.
  Please, set "PHANTOMJS_BIN" env variable.
23 08 2016 19:29:51.338:ERROR [launcher]: [TypeError: Cannot read property 'stderr' of undefined]
TypeError: Cannot read property 'stderr' of undefined
    at Object._start (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma-phantomjs-launcher/index.js:78:18)
    at Object.<anonymous> (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma/lib/launchers/process.js:14:10)
    at emitOne (events.js:82:20)
    at Object.emit (events.js:169:7)
    at Object.start (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma/lib/launchers/base.js:42:10)
    at /Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma/lib/launcher.js:94:17
    at next (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/batch/index.js:118:7)
    at Batch.end (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/batch/index.js:154:5)
    at launch (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma/lib/launcher.js:111:11)
    at invoke (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/di/lib/injector.js:75:15)
    at Server.<anonymous> (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/karma/lib/server.js:171:24)
    at Server.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at Server.emit (events.js:166:7)
    at emitListeningNT (net.js:1260:10)
    at nextTickCallbackWith1Arg (node.js:431:9)




npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/luxueyan/.nvm/versions/node/v4.4.3/bin/node" "/Users/luxueyan/.nvm/versions/node/v4.4.3/bin/npm" "run" "unit"
npm ERR! node v4.4.3
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] unit: `karma start test/unit/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] unit script 'karma start test/unit/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the kt-pano-enquiry-frontend package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     karma start test/unit/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs kt-pano-enquiry-frontend
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls kt-pano-enquiry-frontend

我在karma.conf.js 里面配置process.env.PHANTOMJS_BIN = 'node_modules/phantomjs-prebuilt/bin/phantomjs' 之后 又出现新错误:

 @ ./~/css-loader!./~/vue-loader/lib/style-rewriter.js!./~/sass-loader!./~/vue-loader/lib/selector.js?type=style&index=0!./src/components/kt-slides.vue 3:10-86
23 08 2016 19:43:14.763:WARN [karma]: Port 9876 in use
23 08 2016 19:43:14.766:INFO [karma]: Karma v0.13.22 server started at http://localhost:9877/
23 08 2016 19:43:14.771:INFO [launcher]: Starting browser PhantomJS
23 08 2016 19:43:14.904:ERROR [phantomjs.launcher]: internal/child_process.js:274
  var err = this._handle.spawn(options);
                         ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:274:26)
    at exports.spawn (child_process.js:362:9)
    at Object.<anonymous> (/Users/luxueyan/work/kt-pano-enquiry-frontend/node_modules/phantomjs-prebuilt/bin/phantomjs:22:10)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)

23 08 2016 19:43:14.905:ERROR [launcher]: Cannot start PhantomJS

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproductionThis issue is missing a minimal runnable reproduction, provided by the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions