2017-05-03 19 views
1

を投写JS反応する私は私がこれまで行ってきたどのようなローカルは、私が使用してプロジェクトのビルドを持って

それを実行したい JS反応:

1)インストールのNode.js(窓64ビット)

2)は、今、私は

1を持っているhttps://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm

からステップ3まで続く)C://プログラムファイル/ nodejs/node_mo dules

2)デスクトップ/ reactApp/node_modules

は私がreactApp /内部の私のプロジェクトフォルダを配置します。私はここnpm start

C:\Users\xxx\Desktop\reactApp>npm start 

> [email protected] start C:\Users\jitendra\Desktop\reactApp 
> PORT=8080 react-scripts start 

'PORT' is not recognized as an internal or external command, 
operable program or batch file. 
npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
npm ERR! [email protected] start: `PORT=8080 react-scripts start` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'PORT=8080 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 liquid package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  PORT=8080 react-scripts start 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs liquid 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls liquid 
npm ERR! There is likely additional logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  C:\Users\jitendra\AppData\Roaming\npm-cache\_logs\2017-05-03T08_13_40_048Z-debug.log 

を実行しようとするので、package.jsonは今reactApp/package.jsonで

である私のpackage.jsonファイル

PORTコマンドだけでしょう
{ 
    "name": "liquid", 
    "version": "0.1.0", 
    "private": true, 
    "devDependencies": {}, 
    "dependencies": { 
    "bootstrap": "^4.0.0-alpha.6", 
    "chart.js": "^2.5.0", 
    "google-map-react": "^0.23.0", 
    "lodash": "^4.17.2", 
    "moment": "^2.18.1", 
    "prop-types": "^15.5.8", 
    "react": "^15.5.4", 
    "react-chartjs-2": "^2.0.5", 
    "react-dom": "^15.5.4", 
    "react-redux": "^5.0.1", 
    "react-router": "^2.8.1", 
    "react-router-redux": "^4.0.5", 
    "react-scripts": "^0.9.5", 
    "react-sortable-tree": "^0.1.17", 
    "react-table": "^5.5.3", 
    "reactstrap": "^4.3.0", 
    "redux": "^3.6.0", 
    "redux-logger": "^2.7.4", 
    "redux-thunk": "^2.1.0", 
    "whatwg-fetch": "^2.0.1" 
    }, 
    "scripts": { 
    "start": "PORT=8080 react-scripts start", 
    "build": "react-scripts build && aws s3 sync build/ s3://xxx.co/1micro", 
    "test": "react-scripts test --env=jsdom", 
    "eject": "react-scripts eject" 
    }, 
    "homepage": "http://xxx.co/1micro" 
} 
+0

は、管理者のコマンドプロンプトを実行するようなパッケージのJSON起動スクリプトを使用して、そこPORT=3005 をポート番号を指定します、プロジェクトフォルダのルートに移動し、 'npm install'を実行します。これにより、依存関係に関するいくつかの問題が修正されることがあります。 –

+0

[Create-Reaction-Appベースのプロジェクトを実行するポートを指定する方法は? stackoverflow.com/questions/40714583/how-to-specify- a-port-to-run-a-create-react-app-based-project) –

+0

@MayankShukla、El Rusoの答えは私のjsonファイルと同じです。同じ行にエラーが表示されます。それは窓では動作しないかもしれません。 –

答えて

2

は、プロジェクトのルートに.envファイルを作成し、

以下この "start": "react-scripts start"

サンプルパッケージJSONファイル

{ 
    "name": "r", 
    "version": "0.1.0", 
    "private": true, 
    "devDependencies": { 
    "react-scripts": "0.8.4" 
    }, 
    "dependencies": { 
    "react": "^15.4.2", 
    "react-dom": "^15.4.2" 
    }, 
    "scripts": { 
    "start": "react-scripts start", 
    "build": "react-scripts build", 
    "test": "react-scripts test --env=jsdom", 
    "eject": "react-scripts eject" 
    } 
} 
+0

「反応スクリプト」が内部コマンドまたは外部コマンドとして認識されないと言われました。 –

+0

依存関係を取得するために 'npm install'を実行したいと考えています。あなたのマシンに最初に –

+0

はい、私は反応し、反応domフォルダnode_modulesフォルダ内にあります。 npm応答スクリプトを試してみると、 ' - UNMET DEPENDENCY [email protected]^0.9.5 npm ERR! missing- [email protected]^0.9.5、required by [email protected] –

2

ですUnixで動くコマンドウィンドウを開き、ウィンドウの方法でポート変数を設定してみてください、私はそれが(PowerShellで)だと思う:

$env:PORT=3005 

や、通常のコマンドウィンドウで:

あなたがチェックすることができ
set PORT=3005 

あなたreactAppディレクトリに移動し、実行し、その後、3005を返す必要があります
echo %PORT% 

を::

実行している作品0
react-scripts start 
+0

私のプロジェクトルートディレクトリに$ env:PORT = 3005を実行する必要がありますか? –

+0

と表示されます。ファイル名、ディレクトリ名、またはボリュームラベルの構文が正しくありません。 –

+0

@NiraliJoshi Windows Powershellで実行する$ env:PORT = 3005 –

関連する問題