Search code examples
node.jsnpmgoogle-compute-enginecentos7date-format

Error : npm install ERROR "No Valid versions available for dateFormat"?


I use google cloud engine VM instances is CentOS7. I clone the Node project from git and try to run but

Error : Cannot find module 'dateFormat'

then I have tried to install dateFormat on CentOS7 with

npm install dateFormat

but display error this

npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for dateFormat

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-24T04_43_53_179Z-debug.log

How to fix them ?


Solution

  • Check your spelling of dateFormat, should be all lowercase

    $ npm install dateformat
    

    I just ran both on a vm centos7 with your spelling of uppercase F and all lowercase. Using all lowercase works. see npm page https://www.npmjs.com/package/dateformat while the require seems to use the uppercase F as

    var dateFormat = require('dateformat');
    

    the actual install package is all lowercase

    If doesn't work try: What version of npm are you running? Try removing and reinstalling npm What project are you running from github?