2017-03-09 17 views
0

我想尝试一个简单的例子,在redux-from(https://github.com/erikras/redux-form)中。这个例子的README.md说运行'npm install'在简单的例子中形成''找不到'模块'babel-register'错误

## To run locally 

``` 
npm install 
npm start 
``` 

后,我在本地克隆了Redux格式的项目,我cd到examples/simple和运行npm install。它失败并抛出此异常:

> [email protected] prepublish /Users/antkong/wd/redux-form 
> npm run test && npm run clean && npm run build 


> [email protected] test /Users/antkong/wd/redux-form 
> mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js 

module.js:341 
    throw err; 
    ^

Error: Cannot find module 'babel-register' 
    at Function.Module._resolveFilename (module.js:339:15) 
    at Function.Module._load (module.js:290:25) 
    at Module.require (module.js:367:17) 
    at require (internal/module.js:20:19) 
    at /usr/local/lib/node_modules/mocha/bin/_mocha:337:3 
    at Array.forEach (native) 
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:329:19) 
    at Module._compile (module.js:413:34) 
    at Object.Module._extensions..js (module.js:422:10) 
    at Module.load (module.js:357:32) 
    at Function.Module._load (module.js:314:12) 
    at Function.Module.runMain (module.js:447:10) 
    at startup (node.js:148:18) 
    at node.js:405:3 

npm ERR! Darwin 16.1.0 
npm ERR! argv "/usr/local/Cellar/node5/5.11.1/bin/node" "/usr/local/bin/npm" "run" "test" 
npm ERR! node v5.11.1 
npm ERR! npm v3.10.6 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] test: `mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] test script 'mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js'. 
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 redux-form package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs redux-form 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls redux-form 
npm ERR! There is likely additional logging output above. 
npm WARN Local package.json exists, but node_modules missing, did you mean to install? 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/antkong/wd/redux-form/npm-debug.log 
npm ERR! addLocal Could not install /Users/antkong/wd/redux-form 
npm WARN Local package.json exists, but node_modules missing, did you mean to install? 
npm ERR! Darwin 16.1.0 
npm ERR! argv "/usr/local/Cellar/node5/5.11.1/bin/node" "/usr/local/bin/npm" "install" 
npm ERR! node v5.11.1 
npm ERR! npm v3.10.6 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] prepublish: `npm run test && npm run clean && npm run build` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] prepublish script 'npm run test && npm run clean && npm run build'. 
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 redux-form package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  npm run test && npm run clean && npm run build 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs redux-form 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls redux-form 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/antkong/wd/redux-form/examples/simple/npm-debug.log 

我该如何解决它?我使用

OSX 10.12.1 NPM 2.10.6 节点5.11.1

回答

0

example/simple的README.md留下了一点的细节。我需要首先在回购的根级别运行npm install,然后才能转到simple并在那里运行npm install

相关问题