在服务器上部署React应用程序时出错

时间:2019-03-30 07:12:34

标签: reactjs deployment windows-server npm-start run-script

在服务器上运行应用程序时出现错误 它在本地正常运行,我只需输入运行(npm start)并在本地完美运行。 但是我在服务器上做的同样的事情我得到下面给出的错误。 请有人帮我。

SyntaxError: Unexpected end of input
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:646:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chakde11@1.0.0 build-css: `node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chakde11@1.0.0 build-css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-03-30T06_54_54_535Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chakde11@1.0.0 watch-css: `npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chakde11@1.0.0 watch-css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-03-30T06_54_54_566Z-debug.log
ERROR: "watch-css" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chakde11@1.0.0 start: `npm-run-all -p watch-css start-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chakde11@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-03-30T06_54_54_800Z-debug.log

{   “ name”:“ chakde11”,   “ version”:“ 1.0.0”,   “私人”:假,   “ homepage”:“ http://chakde11.com/”,   “依赖关系”:{     “ bootstrap”:“ 4.1.1”,     “ chart.js”:“ ^ 2.7.2”,     “ classnames”:“ ^ 2.2.6”,     “ d3-geo”:“ ^ 1.10.0”,     “ dateformat”:“ ^ 3.0.3”,     “ faker”:“ ^ 4.1.0”,     “ jsx”:“ ^ 0.9.89”,     “ npm”:“ ^ 6.9.0”,     “ package.json”:“ ^ 2.0.1”,     “ prop-types”:“ ^ 15.6.2”,     “反应”:“ ^ 0.14.9”,     “ react-chartjs-2”:“ ^ 2.7.2”,     “ react-component-queries”:“ ^ 2.3.0”,     “ react-countdown-now”:“ ^ 2.1.0”,     “ react-countdown-to-future-date”:“ 0.0.3”,     “ react-d3-map”:“ ^ 0.8.3”,     “ react-dom”:“ ^ 16.4.1”,     “ react-ga”:“ ^ 2.5.3”,     “ react-icons”:“ ^ 2.2.7”,     “ react-infinite-calendar”:“ ^ 2.3.1”,     “ react-notification-system”:“ ^ 0.2.17”,     “ react-router”:“ ^ 4.3.1”,     “ react-router-dom”:“ ^ 4.3.1”,     “ react-simple-maps”:“ ^ 0.12.1”,     “ react-sizeme”:“ ^ 2.5.2”,     “ react-transition-group”:“ ^ 2.3.1”,     “ reactjs-countdown”:“ 0.0.8”,     “ reactstrap”:“ ^ 6.1.0”,     “胜利”:“ ^ 0.27.1”   },   “ devDependencies”:{     “ gh-pages”:“ ^ 1.2.0”,     “ node-sass-chokidar”:“ ^ 1.3.4”,     “ npm-run-all”:“ ^ 4.1.3”,     “反应脚本”:“ 1.1.4”,     “ serve”:“ ^ 9.1.0”,     “ stylelint”:“ ^ 9.3.0”,     “ stylelint-config-recommended-scss”:“ ^ 3.2.0”,     “ stylelint-config-standard”:“ ^ 18.2.0”,     “ stylelint-order”:“ ^ 0.8.1”,     “ stylelint-scss”:“ ^ 3.1.3”   },   “脚本”:{     “ build-css”:“ node-sass-chokidar --include-path ./src --include-path ./node_modules src / -o src /”,     “ watch-css”:“ npm运行build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src / -o src / --watch --recursive”,     “ start-js”:“反应脚本开始”,     “ start”:“ npm-run-all -p watch-css start-js”,     “ build”:“ npm run build-css && react-scripts build”,     “ serve”:“ serve -s build”,     “ deploy”:“ gh-pages -d build”,     “ test”:“反应脚本测试--env = jsdom”,     “ eject”:“反应脚本弹出”   } }

1 个答案:

答案 0 :(得分:0)

我建议您检查package.json文件的“开始”脚本,然后将命令更改为:

"start": "NODE_PATH=./src npm-run-all -p watch-css start-js",

我发现了与您相同的问题:https://github.com/creativetimofficial/ct-material-dashboard-pro-react/issues/69