2016-10-10 18 views
25

私は2週間触れなかったプロジェクトを持っています。私はそれを取り戻し、今私が実行しようとするとnpm start私はこのエラーを持っています。npmは、create-react-appでエラーを開始します

> react-scripts start 

sh: react-scripts: command not found 

npm ERR! Darwin 16.0.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 
npm ERR! node v6.7.0 
npm ERR! npm v3.10.3 
npm ERR! file sh 
npm ERR! code ELIFECYCLE 
npm ERR! errno ENOENT 
npm ERR! syscall spawn 
npm ERR! [email protected] start: `react-scripts start` 
npm ERR! spawn ENOENT 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'react-scripts 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 UpScore package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  react-scripts start 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs UpScore 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls UpScore 
npm ERR! There is likely additional logging output above. 
  • ノード6.7.0
  • NPM 3.10.3
  • MACシエラ10.12

package.json

{ 
    "name": "UpScore", 
    "version": "0.6.0", 
    "private": true, 
    "devDependencies": { 
    "react-addons-test-utils": "^15.3.1", 
    "react-scripts": "0.4.1", 
    "react-test-renderer": "^15.3.1", 
    "redux-logger": "^2.6.1" 
    }, 
    "dependencies": { 
    "@yoshokatana/medium-button": "^1.1.0", 
    "axios": "^0.14.0", 
    "bcrypt": "^0.8.7", 
    "bcrypt-nodejs": "0.0.3", 
    "bcryptjs": "^2.3.0", 
    "body-parser": "^1.15.2", 
    "connect-flash": "^0.1.1", 
    "cookie-parser": "^1.4.3", 
    "draft-js": "^0.8.1", 
    "draft-js-editor": "^1.7.2", 
    "draft-js-export-html": "^0.4.0", 
    "ejs": "^2.5.2", 
    "email-verification": "^0.4.5", 
    "express": "^4.14.0", 
    "express-session": "^1.14.1", 
    "flexboxgrid": "^6.3.1", 
    "highlight.js": "^9.6.0", 
    "immutable": "^3.8.1", 
    "katex": "^0.6.0", 
    "lodash": "^4.15.0", 
    "markdown-it-mathjax": "^1.0.3", 
    "material-ui": "^0.15.4", 
    "medium-editor": "^5.22.0", 
    "minutes-seconds-milliseconds": "^1.0.3", 
    "moment": "^2.15.0", 
    "moment-duration-format": "^1.3.0", 
    "mongod": "^1.3.0", 
    "mongodb": "^2.2.9", 
    "mongoose": "^4.6.0", 
    "monk": "^3.1.2", 
    "morgan": "^1.7.0", 
    "normalize.css": "^3.0.3", 
    "passport": "^0.3.2", 
    "passport-local": "^1.0.0", 
    "react": "^15.3.1", 
    "react-dom": "^15.3.1", 
    "react-markdown": "^2.4.2", 
    "react-medium-editor": "^1.8.1", 
    "react-redux": "^4.4.5", 
    "react-redux-form": "^0.14.5", 
    "react-rich-markdown": "^1.0.1", 
    "react-router": "^2.7.0", 
    "react-router-redux": "^4.0.5", 
    "react-tap-event-plugin": "^1.0.0", 
    "react-tinymce": "^0.5.1", 
    "redux": "^3.6.0", 
    "redux-form": "^6.0.5", 
    "redux-form-material-ui": "^4.0.1", 
    "redux-promise-middleware": "^4.0.0", 
    "redux-thunk": "^2.1.0", 
    "reselect": "^2.5.3", 
    "screenfull": "^3.0.2" 
    }, 
    "scripts": { 
    "start": "react-scripts start", 
    "start:prod": "pushstate-server build", 
    "build": "react-scripts build", 
    "test": "react-scripts test --env=jsdom", 
    "eject": "react-scripts eject", 
    "server": "cd client/api && pm2 start server.js --watch", 
    "proxy": "http://128.199.139.144:3000" 
    }, 
    "eslintConfig": { 
    "extends": "./node_modules/react-scripts/config/eslint.js" 
    } 
} 

私はあまりにも私のレポのクローンを作成しようとすると、同じエラーが発生します。誰かが私に何が起こるかを見つけるための何らかの方法を与えることができる場合。ありがとうございました

+1

あなたは 'node_modules'を削除して' npm install'をもう一度実行しようとしましたか? – Nitsew

+1

はいnode_modulesをクリーンアップしてnpmをインストールします。 npmのインストールでエラーは発生しませんでした。 – EQuimper

+0

私は 'rm -rf node_modules/&& npm cache clean && npm install'コマンドを使用しています – EQuimper

答えて

82

作成の著者は、Appは、チェックインリアクト

ます。絶対にreact-scriptsをグローバルにインストールしないでください。
また、はありません./node_modules/react-scripts/bin/package.jsonとしてthis answerを含意します。

あなたは、この表示された場合:

npm ERR! [email protected] start: `react-scripts start` 
npm ERR! spawn ENOENT 

をそれはちょうど依存関係が最初にインストールされたとき、何かが間違っていたことを意味します。

私は、これらの3つのステップを実行することをお勧め:それは時々バグがあるので

  1. npm install -g [email protected]がNPMを更新します。
  2. rm -rf node_modules既存のモジュールを削除する。
  3. npm installプロジェクトの依存関係を再インストールします。

これで問題は解決します。
もしそうでなければ、file an issueにプロジェクトとノードとnpmのバージョンへのリンクを付けてください。

+2

ありがとうございました;) – EQuimper

+0

それは私のためには機能しませんでした。 npm v3.3.1;ノードv6.9.1。私はWindows上にあり、この問題は、別の問題を修正するために数週間前にロールバックするシステムを復元した後に始まりました。 – MartinDuo

+0

P.S.:手順を実行すると、このエラーが発生します。 'rm'は内部コマンドまたは外部コマンドとして認識されません。私は、システムの復元は、これらのノードコマンドを実行するために必要なものを削除したと思うが、私はヒントがありません。 – MartinDuo

4

あなたの地球環境にreact-scriptsがないようです。 二つの可能性がここに用意されています

npm install -g react-scripts

たり、package.jsonでスクリプトの一部は次のように変更します。

"scripts": { 
    "start": "./node_modules/react-scripts/bin/react-scripts.js start", 
    "start:prod": "pushstate-server build", 
    "build": "./node_modules/react-scripts/bin/react-scripts.js build", 
    "test": "./node_modules/react-scripts/bin/react-scripts.js test --env=jsdom", 
    "eject": "./node_modules/react-scripts/bin/react-scripts.js eject", 
    "server": "cd client/api && pm2 start server.js --watch", 
    "proxy": "http://128.199.139.144:3000" 
    }, 
+0

今、私はindex.htmlに問題があります。それは、public-dirのcreate-react-app検索のようですか?しかし、私はそれを得る前に。 – EQuimper

+1

changelogを見てください;)https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#050-september-23-2016 –

+0

もう一度パーフェクトあり – EQuimper

1

はい、反応スクリプトをグローバルにインストールしないでください。反応スクリプトは機能しません。

私は私が最初に(別のマシン上の)プロジェクトを作成したとき、これは問題を修正私のために私は、--saveを使用していないと思う:

npm install --save react react-dom react-scripts 
-1

それは他のライブラリと競合可能です、 node_modulesを削除してnpm installを再度実行してください。

0

このコマンドをtermuxで実行するだけでよいです。

pkg install termux-exec proot 
関連する問題