Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run unit 单元测试失败 #154

Closed
luxueyan opened this issue Aug 23, 2016 · 4 comments
Closed

npm run unit 单元测试失败 #154

luxueyan opened this issue Aug 23, 2016 · 4 comments
Labels
needs reproduction This issue is missing a minimal runnable reproduction, provided by the author

Comments

@luxueyan
Copy link

luxueyan commented Aug 23, 2016

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! kt-pano-enquiry-frontend@1.0.0 unit: `karma start test/unit/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kt-pano-enquiry-frontend@1.0.0 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

@posva
Copy link
Member

posva commented Aug 23, 2016

Are you sure you installed the project correctly? The npm install seem to be missing Phantomjs, plus the port is already in use

@posva posva added the needs reproduction This issue is missing a minimal runnable reproduction, provided by the author label Aug 23, 2016
@luxueyan
Copy link
Author

找到原因了,全局装了 phantomjs ,卸载后,重新安装phantomjs-prebuilt就好了

@posva posva closed this as completed Aug 23, 2016
@luxueyan
Copy link
Author

@posva I get it! There is a phantomjs in global. When i remove it and reinstall phantomjs-prebuild, it's ok!
btw: I have a wrong 'import css path' lead to the second err!

@posva
Copy link
Member

posva commented Aug 23, 2016

I'm still seeing an error about Phantomjs not being able to start. You may need to rm -r node_modules and npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction This issue is missing a minimal runnable reproduction, provided by the author
Projects
None yet
Development

No branches or pull requests

2 participants