3

これを使用してreactjsに取り組んでいます

https://github.com/facebookincubator/create-react-app

しかし、ubuntu 16の上でdigitaloceanにデプロイすると、実行できずnpm run build、これがエラーになります。

deploy@xxxx:/www/tmdb_admin$ sudo npm run build
[sudo] password for deploy: 

> tmdb_admin@0.1.0 build /www/tmdb_admin
> react-scripts build

sh: 1: react-scripts: not found

npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v7.3.0
npm ERR! npm  v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! tmdb_admin@0.1.0 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the tmdb_admin@0.1.0 build script 'react-scripts 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 tmdb_admin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tmdb_admin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tmdb_admin
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /www/tmdb_admin/npm-debug.log

これが私のpackage.jsonファイルです。

{
  "name": "tmdb_admin",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "autoprefixer-stylus": "0.10.0",
    "concurrently": "3.0.0",
    "react-scripts": "0.6.1",
    "stylus": "0.54.5"
  },
  "dependencies": {
    "bulma": "^0.2.3",
    "case-sensitive-paths-webpack-plugin": "^1.1.4",
    "es6-promise": "^4.0.5",
    "font-awesome": "^4.7.0",
    "isomorphic-fetch": "^2.2.1",
    "jwt-simple": "^0.5.0",
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-pagify": "^2.1.1",
    "react-redux": "^4.4.5",
    "react-router": "^2.4.0",
    "react-router-redux": "^4.0.4",
    "react-slick": "^0.14.5",
    "redux": "^3.5.2",
    "redux-thunk": "^2.1.0",
    "segmentize": "^0.4.1",
    "slick-carousel": "^1.6.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "watch": "concurrently --names 'webpack, stylus' --prefix name 'npm run start' 'npm run styles:watch'",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "styles": "stylus -u autoprefixer-stylus ./src/css/style.styl -o ./src/css/style.css",
    "styles:watch": "stylus -u autoprefixer-stylus -w ./src/css/style.styl -o ./src/css/style.css"
  }
}

そして、これは私nodenpmバージョンです。

deploy@xxxx:~$ node -v
v7.3.0
deploy@xxxx:~$ npm -v
4.0.5

どうすればこれを修正してnpm run build動作させることができますか?

ありがとう!

4

3 に答える 3