R
R
RailoTheRiolu2021-01-26 22:39:45
Node.js
RailoTheRiolu, 2021-01-26 22:39:45

Discord.JS module installation error in Heroku. How to fix?

I'm writing a JavaScript bot for Discord via Visual Studio Code . In this program, everything is fine, the installation of the modules was successful. I installed cheerio and request . Launched the bot in the program. But, there is a but. I use heroku for 24/7 work , there is no money for a normal hosting right now. In heroku, the node_models folder is not required. Even with it, the folder just goes to ignore, and this does not interfere with the work of the bot. As soon as cheerio and request appear in package.json , things change, it gives an error.

-----> Building on the Heroku-18 stack
-----> 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):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 12.x...
       Downloading and installing node 12.20.1...
       Using default npm version: 6.14.10
       
-----> Restoring cache
       - node_modules
       
-----> Installing dependencies
       Installing node modules
       npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
       npm ERR! 
       npm ERR! 
       npm ERR! Missing: [email protected]^1.0.0-rc.5
       npm ERR! Missing: [email protected]^2.88.2
       npm ERR! 
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.hstm7/_logs/2021-01-26T18_51_13_601Z-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
       
       Some possible problems:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2021-01-27
@RailoTheRiolu

try adding the following key to package.json:

"engines": {
    "node": "ваша_версия_node"
 }

find out the version of node: node -vin the console.
recommended to use xin a patch to get the latest patch updates from Node.
you can also specify a minor range (for example, 14.15) and an exact version (for example, 14.15.4).

M
MrPipka, 2021-01-27
@Mixamixamaxa

certainly not a solution, but there are other free hosting 24/7. For example something.host, try it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question