Сборка героку не удалась. "mongoUrl": // синтаксическая ошибка "mongodb ........" и другие - PullRequest
0 голосов
/ 19 октября 2019

Должен признать, я довольно новичок в программировании. Я делаю онлайн-курс, где я хочу подключить API, используя heroku и mongodb. Я думаю, что у меня возникли некоторые проблемы с выполнением инструкций, потому что видео старше текущего состояния heroku и mongodb. Мне удалось git push heroku master, но когда я добрался до геройку и запустил приложение, там написано, что произошла ошибка. Затем я запустил heroku logs --tail, я проверил свою сборку, и это показало

-----> Node.js app detected



-----> Creating runtime environment



       NPM_CONFIG_LOGLEVEL=error

       NODE_ENV=production

       NODE_MODULES_CACHE=true

       NODE_VERBOSE=false



-----> Installing binaries

       engines.node (package.json):  8.10.0

       engines.npm (package.json):   unspecified (use default)



       Resolving node version 8.10.0...

       Downloading and installing node 8.10.0...

       Using default npm version: 5.6.0



-----> Installing dependencies

       Installing node modules (package.json)



       > uws@9.14.0 install /tmp/build_63fff292b65e6a987cf3dc9195527d57/node_modules/uws

       > node-gyp rebuild > build_log.txt 2>&1 || exit 0





       > core-js@2.6.10 postinstall /tmp/build_63fff292b65e6a987cf3dc9195527d57/node_modules/core-js

       > node postinstall || echo "ignore"



       added 608 packages in 32.816s



-----> Build

       Running build



       > slacky-slack@1.0.0 build /tmp/build_63fff292b65e6a987cf3dc9195527d57

       > babel src -s -D -d dist --presets es2015,stage-0



SyntaxError: src/config/index.js: Unexpected token, expected , (7:21)

   5 |   // "mongoUrl": "mongodb://localhost:27017/chat-api",

   6 |   "port": process.env.PORT,

>  7 |   "mongoUrl": mongodb://esteP:<CEpalacios2019>@chattychatchat-shard-00-00-6ydjb.mongodb.net:27017,chattychatchat-shard-00-01-6ydjb.mongodb.net:27017,chattychatchat-shard-00-02-6ydjb.mongodb.net:27017/test?ssl=true&replicaSet=chattychatchat-shard-0&authSource=admin&retryWrites=true&m=majority ,

     |                      ^

   8 |   "bodyLimit": "100kb"

   9 | }

  10 | 

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! slacky-slack@1.0.0 build: `babel src -s -D -d dist --presets es2015,stage-0`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the slacky-slack@1.0.0 build 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!     /tmp/npmcache.5odQG/_logs/2019-10-19T12_28_48_165Z-debug.log

-----> Build failed



       We're sorry this build is failing! You can troubleshoot common issues here:

       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

FYI, этот файл index.js выглядит как this import mongodb from 'mongodb'; export default { // "port": 3005, // "mongoUrl": "mongodb://localhost:27017/chat-api", "port": process.env.PORT, "mongoUrl": "mongodb://esteP:<**********>@chattychatchat-shard-00-00-6ydjb.mongodb.net:27017,chattychatchat-shard-00-01-6ydjb.mongodb.net:27017,chattychatchat-shard-00-02-6ydjb.mongodb.net:27017/test?ssl=true&replicaSet=chattychatchat-shard-0&authSource=admin&retryWrites=true&w=majority", "bodyLimit": "100kb" }

Я не понимаю большинство этих ошибок,за исключением синтаксической ошибки, но я не знаю, где проблема. Спасибо за всю помощь, которую вы можете оказать этому noob:)

1 Ответ

0 голосов
/ 19 октября 2019

Попробуйте отредактировать src/config/index.js и изменить это:

"mongoUrl": mongodb://esteP:<CEpalacios2019>@chattychatchat-shard-00-00-6ydjb.mongodb.net:27017,chattychatchat-shard-00-01-6ydjb.mongodb.net:27017,chattychatchat-shard-00-02-6ydjb.mongodb.net:27017/test?ssl=true&replicaSet=chattychatchat-shard-0&authSource=admin&retryWrites=true&m=majority

на это:

"mongoUrl": "mongodb://esteP:<CEpalacios2019>@chattychatchat-shard-00-00-6ydjb.mongodb.net:27017,chattychatchat-shard-00-01-6ydjb.mongodb.net:27017,chattychatchat-shard-00-02-6ydjb.mongodb.net:27017/test?ssl=true&replicaSet=chattychatchat-shard-0&authSource=admin&retryWrites=true&m=majority"
...