0
votes

{
  "homepage": "https://github.com/neqts/RWeb.git",
  "name": "react-website",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.5",
    "@testing-library/react": "^11.1.2",
    "@testing-library/user-event": "^12.2.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-icons": "^3.11.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "react-scroll": "^1.8.1",
    "styled-components": "^5.2.1",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run-script build",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "gh-pages": "^3.1.0"
  }
}
`CMD:npm ERR! missing script: build

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ttopo\AppData\Roaming\npm-cache_logs\2020-11-20T07_58_40_339Z-debug.log`

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'deploy' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ] 5 info lifecycle [email protected]~predeploy: [email protected] 6 verbose lifecycle [email protected]~predeploy: unsafe-perm in lifecycle true 7 verbose lifecycle [email protected]~predeploy: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\react2\react-website\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Users\ttopo\AppData\Local\Microsoft\WindowsApps;;C:\Users\ttopo\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ttopo\AppData\Roaming\npm 8 verbose lifecycle [email protected]~predeploy: CWD: C:\react2\react-website 9 silly lifecycle [email protected]~predeploy: Args: [ '/d /s /c', 'npm run-script build' ] 10 silly lifecycle [email protected]~predeploy: Returned: code: 1 signal: null 11 info lifecycle [email protected]~predeploy: Failed to exec predeploy script 12 verbose stack Error: [email protected] predeploy: npm run-script build 12 verbose stack Exit status 1 12 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 12 verbose stack at EventEmitter.emit (events.js:315:20) 12 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 12 verbose stack at ChildProcess.emit (events.js:315:20) 12 verbose stack at maybeClose (internal/child_process.js:1048:16) 12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) 13 verbose pkgid [email protected] 14 verbose cwd C:\react2\react-website 15 verbose Windows_NT 10.0.19041 16 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "deploy" 17 verbose node v14.14.0 18 verbose npm v6.14.8 19 error code ELIFECYCLE 20 error errno 1 21 error [email protected] predeploy: npm run-script build 21 error Exit status 1 22 error Failed at the [email protected] predeploy script. 22 error This is probably not a problem with npm. There is likely additional logging output above. 23 verbose exit [ 1, true ]

I try to put my react application on the server, but when starting npm run build a myth pops up like an error someone has an idea what I am doing wrong if I ask for help, I am grateful for your time

1
Check the scripts field in the package.json, it seems like you're missing the "build" command declaration there. If the project is created using create-react-app, try adding this: "build": "react-scripts build" and running again - theVoogie

1 Answers

3
votes

the error say that the build script is missing, so please add the below definition to your script config settings.

"build": "react-scripts build"