Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'getInstance' of undefined #555

Closed
ghost opened this issue Aug 10, 2020 · 24 comments
Closed

Cannot read property 'getInstance' of undefined #555

ghost opened this issue Aug 10, 2020 · 24 comments

Comments

@ghost
Copy link

ghost commented Aug 10, 2020

Cannot do anything with vs code and salesforce.

This error occurs for any of the commands. Reinstalled latest node.js just in case.

stack:
"status": 1, "name": "TypeError", "message": "Cannot read property 'getInstance' of undefined", "exitCode": 1, "commandName": "ConfigGetCommand", "stack": "TypeError: Cannot read property 'getInstance' of undefined\n at ConfigGetCommand.hooksFromLifecycleEvent (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\node_modules\@salesforce\command\lib\sfdxCommand.js:401:44)\n at ConfigGetCommand.init (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\node_modules\@salesforce\command\lib\sfdxCommand.js:248:20)\n at async ConfigGetCommand._run (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\node_modules\@salesforce\command\lib\sfdxCommand.js:92:13)\n at async Config.runCommand (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\config\lib\config.js:172:9)\n at async Main.run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\command\lib\main.js:22:9)\n at async Main._run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\command\lib\command.js:43:20)\n at async Object.run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\dist\cli.js:32:20)\nOuter stack:\n at Function.wrap (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\node_modules\@salesforce\core\lib\sfdxError.js:151:27)\n at ConfigGetCommand.catch (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\dist\ToolbeltCommand.js:247:46)\n at async ConfigGetCommand._run (C:\Users\jeepg\AppData\Local\sfdx\node_modules\salesforce-alm\node_modules\@salesforce\command\lib\sfdxCommand.js:97:13)\n at async Config.runCommand (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\config\lib\config.js:172:9)\n at async Main.run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\command\lib\main.js:22:9)\n at async Main._run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\node_modules\@oclif\command\lib\command.js:43:20)\n at async Object.run (C:\Users\jeepg\AppData\Local\sfdx\client\7.69.0-c7be45ae22\dist\cli.js:32:20)", "warnings": []}

@AnanyaJha
Copy link
Collaborator

Hi @mattmccafferty thanks for reporting this! Do you mind giving us some more info: what version of the extensions are you on? and what version of the cli? You can find the cli version by running sfdx --version from the terminal. Thanks!

@ghost
Copy link
Author

ghost commented Aug 10, 2020

Extension: v49.4.0
sfdx-cli/7.69.0-c7be45ae22 win32-x64 node-v12.18.3

@lcampos lcampos transferred this issue from forcedotcom/salesforcedx-vscode Aug 10, 2020
@amphro
Copy link
Contributor

amphro commented Aug 10, 2020

What plugins do you have installed? sfdx plugins?

@ghost
Copy link
Author

ghost commented Aug 10, 2020

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.7.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/lwc-dev-server 2.5.1
├─ @oclif/plugin-update 1.3.9
└─ @oclif/plugin-help 2.2.3
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.12.0 (core)
generator 1.1.3 (core)
salesforcedx 49.5.0
├─ salesforcedx-templates 49.2.0
├─ custom-metadata 1.0.8
├─ salesforce-alm 49.5.0
└─ @salesforce/sfdx-plugin-lwc-test 0.1.7

@ghost
Copy link
Author

ghost commented Aug 10, 2020

Did an update, just to try it:

sfdx update
sfdx-cli: Updating CLI... already on latest version: 7.69.0-c7be45ae22
warning "@salesforce/lwc-dev-server > @rollup/plugin-alias@3.1.1" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
warning "@salesforce/lwc-dev-server > request-promise-native@1.0.8" has unmet peer dependency "request@^2.34".
warning "@salesforce/lwc-dev-server > request-promise-native > request-promise-core@1.1.3" has unmet peer dependency "request@^2.34".
sfdx-cli: Updating plugins... done

sfdx force:org:open
ERROR running force:org:open: Cannot read property 'getInstance' of undefined

@ghost
Copy link
Author

ghost commented Aug 10, 2020

Also tried this:

npm install --global sfdx-cli
npm WARN deprecated request@2.88.2: request has been deprecated, see request/request#3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.0: request has been deprecated, see request/request#3142
npm WARN deprecated request-promise-native@1.0.5: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
C:\Users\jeepg\AppData\Roaming\npm\sfdx -> C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\bin\run

dtrace-provider@0.6.0 install C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\dtrace-provider
node scripts/install.js

husky@4.2.5 install C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\husky
node husky install

husky > Setting up git hooks
husky > Done

salesforcedx@49.5.0 install C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\salesforcedx
node ./index.js

core-js@2.6.11 postinstall C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

ejs@2.7.4 postinstall C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\ejs
node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

husky@4.2.5 postinstall C:\Users\jeepg\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\husky
opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:

https://opencollective.com/husky/donate

  • sfdx-cli@7.69.0
    added 1138 packages from 707 contributors in 78.479s

@jackkohn
Copy link

I am experiencing the exact same problem. Unable to run any sfdx commands.
Version: sfdx-cli/7.69.0-c7be45ae22 win32-x64 node-v12.18.3

@ghost
Copy link
Author

ghost commented Aug 10, 2020

its failing with this line:
const lifecycle = core_1.Lifecycle.getInstance();

@ghost
Copy link
Author

ghost commented Aug 10, 2020

looks like salesforce-alm was introduced to my system this morning...

@jackkohn
Copy link

@mattmccafferty I'm fairly certain its related to the sfdx update. I was able to deploy a package on friday using vscode, then installed the latest version of sfdx. This is when everything stopped working

@ghost
Copy link
Author

ghost commented Aug 10, 2020

It must have updated this morning as the timestamp I have is 8:58AM on the salesforce-alm folder and that appears to have been published 4 days ago, and I was working fine on Friday too....

just tried this too:
npm i -g salesforce-alm
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.0: request has been deprecated, see request/request#3142
npm WARN deprecated request-promise-native@1.0.5: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

dtrace-provider@0.6.0 install C:\Users\jeepg\AppData\Roaming\npm\node_modules\salesforce-alm\node_modules\dtrace-provider
node scripts/install.js

core-js@2.6.11 postinstall C:\Users\jeepg\AppData\Roaming\npm\node_modules\salesforce-alm\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

  • salesforce-alm@49.5.0
    added 651 packages from 550 contributors in 35.07s

@aabrego-sfdc
Copy link

Having the same issue here:

 $ sfdx force                                                          
ERROR running force:  Cannot read property 'getInstance' of undefined
 $ sfdx force:org:list
ERROR running force:org:list:  Cannot read property 'getInstance' of undefined
 $ sfdx --version
sfdx-cli/7.69.0-c7be45ae22 darwin-x64 node-v12.18.3
$ sfdx plugins                                        
@salesforce/lwc-dev-server 2.5.1
├─ @oclif/plugin-help 2.2.3
└─ @oclif/plugin-update 1.3.10
force-language-services 47.6.0
salesforce-alm 49.5.0
salesforce-lightning-cli 3.0.0
salesforcedx 49.5.0
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7
├─ salesforcedx-templates 49.2.0
└─ custom-metadata 1.0.8

@theajaygupta
Copy link

Hi team,

I am also getting the same error. since update.

My version: sfdx-cli/7.69.0-c7be45ae22 darwin-x64 node-v12.18.3

Error information:

"status": 1, "name": "TypeError", "message": "Cannot read property 'getInstance' of undefined", "exitCode": 1, "commandName": "ConfigGetCommand", "stack": "TypeError: Cannot read property 'getInstance' of undefined\n at ConfigGetCommand.hooksFromLifecycleEvent (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:401:44)\n at ConfigGetCommand.init (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:248:20)\n at async ConfigGetCommand._run (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:92:13)\n at async Config.runCommand (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)\nOuter stack:\n at Function.wrap (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n at ConfigGetCommand.catch (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:247:46)\n at async ConfigGetCommand._run (/Users/ajgupta/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13)\n at async Config.runCommand (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/ajgupta/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)", "warnings": []}

@amphro
Copy link
Contributor

amphro commented Aug 10, 2020

Can you try removing your installed version of salesforcedx? It looks like it isn't playing nice with a new library version, even though that is in the module path.

sfdx plugins:uninstall salesforcedx

@amphro
Copy link
Contributor

amphro commented Aug 10, 2020

In fact, please remove all these plugins: force-language-services, salesforce-alm, salesforce-lightning-cli

Those are bundled with the CLI and there is no reason to have it installed unless you are tiring to pin to a specific branch or an earlier version.

If you really are trying to link to an older version, try uninstalling it and reinstalling that plugin. If you still get there error then, I'll try to see why the oclif module resolution is failing.

@ghost
Copy link
Author

ghost commented Aug 10, 2020

Can you try removing your installed version of salesforcedx? It looks like it isn't playing nice with a new library version, even though that is in the module path.

sfdx plugins:uninstall salesforcedx

this appears to have worked....

sfdx plugins:uninstall salesforcedx
warning "@salesforce/lwc-dev-server > @rollup/plugin-alias@3.1.1" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
warning "@salesforce/lwc-dev-server > request-promise-native@1.0.8" has unmet peer dependency "request@^2.34".
warning "@salesforce/lwc-dev-server > request-promise-native > request-promise-core@1.1.3" has unmet peer dependency "request@^2.34".
Uninstalling salesforcedx... done

@ghost
Copy link
Author

ghost commented Aug 10, 2020

force-language-services

After I uninstalled salesforcedx, tried the additional ones. One said I still had salesforcedx installed...

did I do this right?? each failed...

sfdx plugins:uninstall force-language-services
Uninstalling force-language-services... !
» Error: force-language-services is not installed

sfdx plugins:uninstall salesforce-alm
Uninstalling salesforce-alm... !
» Error: salesforce-alm is installed via plugin salesforcedx, uninstall salesforcedx instead

sfdx plugins:uninstall salesforce-lightning-cli
Uninstalling salesforce-lightning-cli... !
» Error: salesforce-lightning-cli is not installed

@ghost ghost closed this as completed Aug 10, 2020
@amphro
Copy link
Contributor

amphro commented Aug 10, 2020

That was only for the people who did have them installed, like @aabrego-sfdc

@jefersonchaves
Copy link

jefersonchaves commented Aug 11, 2020

That also worked for me but I don't recall to have installed any plugin manually previously. Thanks @amphro and @mattmccafferty

Summarizing the commands for anyone with the same issue:

sfdx plugins:uninstall salesforcedx
sfdx plugins:uninstall force-language-services
sfdx plugins:uninstall salesforce-alm
sfdx plugins:uninstall salesforce-lightning-cli
sfdx plugins:install salesforcedx

@ghost
Copy link
Author

ghost commented Aug 11, 2020

yeah, i never installed them either.

@amphro
Copy link
Contributor

amphro commented Aug 11, 2020

@jefersonchaves you don't need to install salesforcedx as it is bundled with the cli. Only install it if you need to pin to a future version. Since you didn't specify a version, I'm assuming you want latest so it is better to use the one that is shipped with the CLI.

sfdx plugins:uninstall salesforcedx
sfdx plugins --core

You will still see salesforcedx in the output above.

@jefersonchaves
Copy link

@amphro: fair enough, I just commented that I don't recall having installed the other ones. So I forced the uninstall anyway, including salesforcedx and then re-installed salesforcedx only.

@amphro
Copy link
Contributor

amphro commented Aug 11, 2020

Ya, I'm saying you shouldn't reinstall salesforcedx.

@aabrego-sfdc
Copy link

I uninstalled all these 4 plugins:

sfdx plugins:uninstall salesforcedx
sfdx plugins:uninstall force-language-services
sfdx plugins:uninstall salesforce-alm
sfdx plugins:uninstall salesforce-lightning-cli

And my force commands are working now!


My final configuration looks like this:

 $ sfdx plugins       
@salesforce/lwc-dev-server 2.5.1
├─ @oclif/plugin-help 2.2.3
└─ @oclif/plugin-update 1.3.10
 $ sfdx plugins --core                            
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.7.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/lwc-dev-server 2.5.1
├─ @oclif/plugin-help 2.2.3
└─ @oclif/plugin-update 1.3.10
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.12.0 (core)
generator 1.1.3 (core)
salesforcedx 49.5.0 (core)
├─ custom-metadata 1.0.8 (core)
├─ salesforcedx-templates 49.2.0 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
└─ salesforce-alm 49.5.0 (core)
sfdx-cli 7.69.0 (core)
 $ sfdx --version
sfdx-cli/7.69.0-c7be45ae22 darwin-x64 node-v12.18.3

Thanks @amphro and everyone for your input.

@amphro Separate but related question: why @salesforce/lwc-dev-server plugin is also listed along with the --core plugins?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants