react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

npm run test error #241

Closed jerrygg19930312 closed 7 years ago

jerrygg19930312 commented 8 years ago

after I use "yo react-webpack" to generate a new project.I did not modify any code.When I run npm run test,I see the error message D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\di\0.0.1\di\lib\injector.js:9 throw error('No provider for "' + name + '"!'); ^

Error: No provider for "framework:mocha"! (Resolving: framework:mocha) at error (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\di\0.0.1\di\lib\injector.js:22:12) at Object.parent.get (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\di\0.0.1\di\lib\injector.js:9:13) at get (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\di\0.0.1\di\lib\injector.js:54:19) at D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\karma\0.13.22\karma\lib\server.js:138:20 at Array.forEach (native) at Server._start (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\karma\0.13.22\karma\lib\server.js:137:21) at invoke (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\di\0.0.1\di\lib\injector.js:75:15) at Server.start (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\karma\0.13.22\karma\lib\server.js:102:18) at Object.exports.run (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\karma\0.13.22\karma\lib\cli.js:243:26) at Object. (D:\work-dev\react-gallery\gallery-by-react\node_modules.npminstall\karma\0.13.22\karma\bin\karma:3:23) 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)

weblogixx commented 8 years ago

Hi @jerrygg19930312,

seems like there are not all dependencies installed correctly. Karma-Mocha seems to be missing. Please run npm install again and look if it installs the missing dependencies. If this does not work you may try one of the following methods:

We had some problems with modules that where not installable at the first try, most people with this problem where able to fix it with reinstalling the modules. Seems to be a common problem with the Great Wall of China for example (had 3 or 4 issues that looked nearly the same from China).

Hope this fixes your problems.

zhe-he commented 8 years ago

I also encountered a similar problem, the following error message:

`START: 05 08 2016 17:58:13.610:INFO [karma]: Karma v0.13.22 server started at http://localhost:8000/ 05 08 2016 17:58:13.624:INFO [launcher]: Starting browser PhantomJS 05 08 2016 17:58:15.449:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#so1tch1w0P-ZsDgrAAAA with id 85206816 PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR SyntaxError: Unexpected token 'const' at d:/AjaxEngine/download/yo/Gallery/test/loadtests.js:47

Finished in 0.102 secs / 0 secs

SUMMARY: √ 0 tests completed

npm ERR! Windows_NT 10.0.10586 npm ERR! argv "d:\Program Files\nodejs\node.exe" "d:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "test" npm ERR! node v6.3.1 npm ERR! npm v3.10.3 npm ERR! code ELIFECYCLE npm ERR! gallery@0.0.1 test: karma start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the gallery@0.0.1 test script 'karma start'. 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 gallery package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! karma start npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs gallery npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls gallery npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! d:\AjaxEngine\download\yo\Gallery\npm-debug.log`

weblogixx commented 8 years ago

Hi @zhe-he,

could you eventually provide a link to the repository you are testing it on? It seems like you are using the const keyword somewhere without transpiling via babel and I cannot reproduce this issue with a freshly generated setup.

weblogixx commented 7 years ago

There was nothing new on this issue since nearly 2 month, I will close this for now. Please feel free to reopen this issue (or open a new one) if there are still problems left...