Cli: Cannot find module package.json

Created on 5 Jan 2018  路  4Comments  路  Source: heroku/cli

I just found that my heroku CLI is broken. No matter which command I execute, it crashes with the following error:

module.js:557
    throw err;
    ^

Error: Cannot find module '%USERPROFILE%\AppData\Local\heroku\client\package.json'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at run (C:\Users\Alex\AppData\Local\heroku\client\node_modules\@cli-engine\engine\lib\cli.js:82:22)
    at Object.<anonymous> (C:\Users\Alex\AppData\Local\heroku\client\bin\heroku.js:7:1)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)

I am using heroku from PowerShel on a Windows 10 machine.
This error starts after I wrongfully typed the command heroku container help. Not knowing if it breaks something in the heroku CLI.

Edit:
After reinstall (did not reboot) my heroku CLI can run again. Did not know the version of the broken one because I did not keep the old setup file. But it should be fairly new because I just started to use heroku a few days ago.
node.exe -v reports 8.9.3

Most helpful comment

as discussed in https://github.com/heroku/cli/issues/653 this was due to a cleanup process that was too eager and deleted some essential files for some installs. A fix is out and if you're experiencing this, delete ~/.local/share/heroku/client and it should resolve itself.

All 4 comments

same issue Windows 10, Powershell.

module.js:557
    throw err;
    ^

Error: Cannot find module '%USERPROFILE%\AppData\Local\heroku\client\package.json'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at run (%USERPROFILE%\AppData\Local\heroku\client\node_modules\@cli-engine\engine\lib\cli.js:82:22)
    at Object.<anonymous> (%USERPROFILE%\AppData\Local\heroku\client\bin\heroku.js:7:1)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)

Edit:

Did a full reinstall and reboot and managed to run heroku login
version is: heroku-cli/6.15.5-1f03166 (win32-x64) node-v9.3.0

as discussed in https://github.com/heroku/cli/issues/653 this was due to a cleanup process that was too eager and deleted some essential files for some installs. A fix is out and if you're experiencing this, delete ~/.local/share/heroku/client and it should resolve itself.

On windows, I deleted C:\Users\your_user_name\AppData\Local\heroku\client

@janoulle Thank you so much. This worked for me!

Was this page helpful?
0 / 5 - 0 ratings