Unable to create SFDX Project
I am unable to create a SFDX project in IntelliJ. I have successfully created it from the sfdx CLI and even the line that is being executed from IntelliJ works when I do it from the command line, but why is it not working in IntelliJ. Any help is appreciated.
Thanks in advance,
Terrance
INTELLIJ VERSION:
2020.1.1. IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 29, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 6077M
Cores: 8
Non-Bundled Plugins: net.seesharpsoft.intellij.plugins.csv, com.intellij.plugins.html.instantEditing, io.artage.sfcc.salesforce-commerce-cloud, com.illuminatedcloud2.intellij, org.intellij.scala
2020-05-10 20:22:44,578 [ 50820] DEBUG - atedcloud.util.CommandLineUtil - Running command line: '/usr/local/lib/sfdx/bin/sfdx force:project:create -d /Users/tgrahn/Documents/dev -n geo2 -p force-app -x --json' from working directory: '/Users/tgrahn/Documents/dev/geo2'.
2020-05-10 20:22:44,591 [ 50833] DEBUG - .VariableLengthPollingInterval - /usr/local/lib/sfdx/bin/sfdx force:project:create -d /Users/tgrahn/Documents/dev -n geo2 -p force-app -x --json: Using polling interval 1000 ms for polling iteration 1.
2020-05-10 20:22:45,596 [ 51838] DEBUG - atedcloud.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=1, output='{ "status": 1, "name": "Error", "message": "Command failed with ENOENT: npm root -g --prefix /Users/tgrahn/Documents/dev/geo2/.yo-repository --loglevel error\nspawnSync npm ENOENT", "exitCode": 1, "commandName": "Project", "stack": "Error: Command failed with ENOENT: npm root -g --prefix /Users/tgrahn/Documents/dev/geo2/.yo-repository --loglevel error\nspawnSync npm ENOENT\n at Object.spawnSync (internal/child_process.js:990:20)\n at Object.spawnSync (child_process.js:601:24)\n at Proxy.module.exports.sync (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/execa/index.js:169:25)\n at Object.runPackageManager (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/util/repository.js:114:18)\n at Object.get nodeModulesPath [as nodeModulesPath] (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/util/repository.js:40:36)\n at Function.assign (<anonymous>)\n at new Environment (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/environment.js:257:30)\n at Proxy.createEnv (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/environment.js:113:12)\n at Project.<anonymous> (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/lib/utils/templateCommand.js:40:32)\n at Generator.next (<anonymous>)\nOuter stack:\n at Function.wrap (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/@salesforce/command/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n at Project.catch (/Users/tgrahn/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/@salesforce/command/lib/sfdxCommand.js:255:67)", "warnings": []}', error='', duration=1018}
Comments (19)
-
repo owner -
reporter Yep - that did it. I uninstalled sfdx per this doc:
Reinstalled and was able to create a project with no issues - thanks for the tip. I love easy solutions
-
reporter - changed status to resolved
Issue fixed by uninstalling / installing Salesforce SFDX CLI
-
repo owner Glad that took care of it!
-
Hi,
I’m having the same issue I tried unistalling the sfdx cli per the process in the developer docs but I still can’t get it to work. I have been able to create a project via the cli.
IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 29, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: com.illuminatedcloud2.intellijsfdx-cli/7.57.1-dbf54fc584 darwin-x64 node-v10.15.3
2020-05-13 10:35:54,308 [1013279] DEBUG - atedcloud.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=1, output='{ "status": 1, "name": "Error", "message": "Command failed with ENOENT: npm root -g --prefix /Users/gemandala/IdeaProjects/testdx6/.yo-repository --loglevel error\nspawnSync npm ENOENT", "exitCode": 1, "commandName": "Project", "stack": "Error: Command failed with ENOENT: npm root -g --prefix /Users/gemandala/IdeaProjects/testdx6/.yo-repository --loglevel error\nspawnSync npm ENOENT\n at Object.spawnSync (internal/child_process.js:990:20)\n at Object.spawnSync (child_process.js:601:24)\n at Proxy.module.exports.sync (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/execa/index.js:169:25)\n at Object.runPackageManager (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/util/repository.js:114:18)\n at Object.get nodeModulesPath [as nodeModulesPath] (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/util/repository.js:40:36)\n at Function.assign (<anonymous>)\n at new Environment (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/environment.js:257:30)\n at Proxy.createEnv (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/yeoman-environment/lib/environment.js:113:12)\n at Project.<anonymous> (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/lib/utils/templateCommand.js:40:32)\n at Generator.next (<anonymous>)\nOuter stack:\n at Function.wrap (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/@salesforce/command/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n at Project.catch (/Users/gemandala/.local/share/sfdx/client/7.57.1-dbf54fc584/node_modules/salesforcedx-templates/node_modules/@salesforce/command/lib/sfdxCommand.js:255:67)", "warnings": []}', error='', duration=2006}
-
repo owner George, have you also tried uninstalling/reinstalling the CLI? That worked for Terrance, and the stack trace here is deep within the CLI for a standard invocation. Assuming(/hoping) that works, now that this has been observed twice, I'll make sure that the Salesforce CLI team knows about it as it seems to be another regression in the most recent version(s) of the CLI.
-
I tried uninstalling and reinstalling the CLI via and I couldn’t get it to work. I used this to uninstall the CLI.
sudo rm -rf /usr/local/sfdx sudo rm -rf /usr/local/lib/sfdx sudo rm -rf /usr/local/bin/sfdx sudo rm -rf ~/.local/share/sfdx ~/.config/sfdx ~/.cache/sfdx sudo rm -rf ~/Library/Caches/sfdx
Am I missing something?
-
repo owner George, so after a full uninstall/reinstall, you're still seeing the same issue, correct? If so, let's try to isolate this to the CLI and remove Illuminated Cloud from the picture (or not, as the case may be). Can you please add the following to Help>Diagnostic Tools>Debug Log Settings (the leading
#
s must be present):#com.illuminatedcloud.util.CommandLineUtil #com.illuminatedcloud.intellij.sfdx.SfdxUtil #com.illuminatedcloud.util.VariableLengthPollingInterval
then please reproduce the issue and provide the resulting
idea.log
, either as an attachment here or via email to support@illuminatedcloud.com. You can find the log using Help>Show Log in Finder.That will show me the exact CLI invocation that was used. I then want you to run that same CLI invocation directly from the command-line and see whether it exhibits the same behavior.
-
- attached gemandala-idea.log.zip
-
I just executed the command locally on my machine and it worked successfully.
gemandala@Georges-MacBook-Pro ~ % sfdx force:project:create -d /Users/gemandala/IdeaProjects -n TestDX10 -p force-app -x --json { "status": 0, "result": { "outputDir": "/Users/gemandala/IdeaProjects", "created": [ "IdeaProjects/TestDX10/config/project-scratch-def.json", "IdeaProjects/TestDX10/README.md", "IdeaProjects/TestDX10/sfdx-project.json", "IdeaProjects/TestDX10/manifest/package.xml", "IdeaProjects/TestDX10/.vscode/extensions.json", "IdeaProjects/TestDX10/.vscode/launch.json", "IdeaProjects/TestDX10/.vscode/settings.json", "IdeaProjects/TestDX10/force-app/main/default/lwc/.eslintrc.json", "IdeaProjects/TestDX10/scripts/soql/account.soql", "IdeaProjects/TestDX10/scripts/apex/hello.apex", "IdeaProjects/TestDX10/.eslintignore", "IdeaProjects/TestDX10/.forceignore", "IdeaProjects/TestDX10/.gitignore", "IdeaProjects/TestDX10/.prettierignore", "IdeaProjects/TestDX10/.prettierrc", "IdeaProjects/TestDX10/package.json" ], "rawOutput": "target dir = /Users/gemandala/IdeaProjects\n create IdeaProjects/TestDX10/config/project-scratch-def.json\n create IdeaProjects/TestDX10/README.md\n create IdeaProjects/TestDX10/sfdx-project.json\n create IdeaProjects/TestDX10/manifest/package.xml\n create IdeaProjects/TestDX10/.vscode/extensions.json\n create IdeaProjects/TestDX10/.vscode/launch.json\n create IdeaProjects/TestDX10/.vscode/settings.json\n create IdeaProjects/TestDX10/force-app/main/default/lwc/.eslintrc.json\n create IdeaProjects/TestDX10/scripts/soql/account.soql\n create IdeaProjects/TestDX10/scripts/apex/hello.apex\n create IdeaProjects/TestDX10/.eslintignore\n create IdeaProjects/TestDX10/.forceignore\n create IdeaProjects/TestDX10/.gitignore\n create IdeaProjects/TestDX10/.prettierignore\n create IdeaProjects/TestDX10/.prettierrc\n create IdeaProjects/TestDX10/package.json\n" } } gemandala@Georges-MacBook-Pro ~ %
-
repo owner Thanks. Can you check a few things. First, it appears you ran it from your home directory based on the CLI prompt. Is that correct? IC is running it from the directory
/Users/gemandala/IdeaProjects/TestDX10
. Does it work if you run it from there?Also, can you type
which sfdx
and verify that it yields/usr/local/lib/sfdx/bin/sfdx
which is the binary that IC is executing? -
Hi Scott,
I verified that that’s the correct path for the sfdx executable.
gemandala@Georges-MacBook-Pro bin % which sfdx /usr/local/bin/sfdx gemandala@Georges-MacBook-Pro bin % pwd /usr/local/bin gemandala@Georges-MacBook-Pro bin % ls -l|grep sfdx lrwxr-xr-x 1 root wheel 28 May 13 10:15 sfdx -> /usr/local/lib/sfdx/bin/sfdx gemandala@Georges-MacBook-Pro bin %
I also tried running the command with the full path and it ran successfully.
gemandala@Georges-MacBook-Pro ~ % /usr/local/lib/sfdx/bin/sfdx force:project:create -d /Users/gemandala/IdeaProjects -n TestDX11 -p force-app -x --json { "status": 0, "result": { "outputDir": "/Users/gemandala/IdeaProjects", "created": [ "IdeaProjects/TestDX11/config/project-scratch-def.json", "IdeaProjects/TestDX11/README.md", "IdeaProjects/TestDX11/sfdx-project.json", "IdeaProjects/TestDX11/manifest/package.xml", "IdeaProjects/TestDX11/.vscode/extensions.json", "IdeaProjects/TestDX11/.vscode/launch.json", "IdeaProjects/TestDX11/.vscode/settings.json", "IdeaProjects/TestDX11/force-app/main/default/lwc/.eslintrc.json", "IdeaProjects/TestDX11/scripts/soql/account.soql", "IdeaProjects/TestDX11/scripts/apex/hello.apex", "IdeaProjects/TestDX11/.eslintignore", "IdeaProjects/TestDX11/.forceignore", "IdeaProjects/TestDX11/.gitignore", "IdeaProjects/TestDX11/.prettierignore", "IdeaProjects/TestDX11/.prettierrc", "IdeaProjects/TestDX11/package.json" ], "rawOutput": "target dir = /Users/gemandala/IdeaProjects\n create IdeaProjects/TestDX11/config/project-scratch-def.json\n create IdeaProjects/TestDX11/README.md\n create IdeaProjects/TestDX11/sfdx-project.json\n create IdeaProjects/TestDX11/manifest/package.xml\n create IdeaProjects/TestDX11/.vscode/extensions.json\n create IdeaProjects/TestDX11/.vscode/launch.json\n create IdeaProjects/TestDX11/.vscode/settings.json\n create IdeaProjects/TestDX11/force-app/main/default/lwc/.eslintrc.json\n create IdeaProjects/TestDX11/scripts/soql/account.soql\n create IdeaProjects/TestDX11/scripts/apex/hello.apex\n create IdeaProjects/TestDX11/.eslintignore\n create IdeaProjects/TestDX11/.forceignore\n create IdeaProjects/TestDX11/.gitignore\n create IdeaProjects/TestDX11/.prettierignore\n create IdeaProjects/TestDX11/.prettierrc\n create IdeaProjects/TestDX11/package.json\n" } }
-
repo owner Hi, George. I'm pretty sure the issue is with the directory from which you run that command. Please try this:
$ cd /Users/gemandala/IdeaProjects/TestDX10 $ sfdx force:project:create -d /Users/gemandala/IdeaProjects -n TestDX11 -p force-app -x --json
The reason I think that the working directory may be part of the issue is the following from the error when IC runs it from that same directory:
Command failed with ENOENT: npm root -g --prefix /Users/gemandala/IdeaProjects/testdx6/.yo-repository --loglevel error\nspawnSync npm ENOENT
Notice that the error points to a file/directory under the specified directory.
Perhaps that won't be the case, but the only difference between how you're running it and how IC is running it is the working directory at the time of execution.
-
You’re correct. That didn’t work. How do I stop IC from doing it? In the project creation dialogs I use the default values.
gemandala@Georges-MacBook-Pro bin % cd /Users/gemandala/IdeaProjects/TestDX10 gemandala@Georges-MacBook-Pro TestDX10 % sfdx force:project:create -d /Users/gemandala/IdeaProjects -n TestDX11 -p force-app -x --json { "status": 0, "result": { "outputDir": "/Users/gemandala/IdeaProjects", "created": [], "rawOutput": "target dir = /Users/gemandala/IdeaProjects\nidentical ../TestDX11/config/project-scratch-def.json\nidentical ../TestDX11/README.md\nidentical ../TestDX11/sfdx-project.json\nidentical ../TestDX11/manifest/package.xml\nidentical ../TestDX11/.vscode/extensions.json\nidentical ../TestDX11/.vscode/launch.json\nidentical ../TestDX11/.vscode/settings.json\nidentical ../TestDX11/force-app/main/default/lwc/.eslintrc.json\nidentical ../TestDX11/scripts/soql/account.soql\nidentical ../TestDX11/scripts/apex/hello.apex\nidentical ../TestDX11/.eslintignore\nidentical ../TestDX11/.forceignore\nidentical ../TestDX11/.gitignore\nidentical ../TestDX11/.prettierignore\nidentical ../TestDX11/.prettierrc\nidentical ../TestDX11/package.json\n" } } gemandala@Georges-MacBook-Pro TestDX10 %
-
repo owner Okay, so that successfully reproduces the issue outside of IC. Unfortunately there's not way to tell IC to create a scratch org from a different working directory. The issue here is a bug in the CLI, not in IC. I'm currently working with the Salesforce CLI team to help them reproduce and squash these bugs. Since you're evidently one of the "lucky few" to experience this one, there are only two workarounds available:
- Roll back to the previous CLI version using
sfdx plugins:install salesforcedx@48.10.1
. When the new version is released with the fixes, you'll need to uninstall and reinstall the plugin to get back onto the latest. - Use the CLI to create your projects until it's fixed.
I'll convey this additional information to the Salesforce CLI team. Hopefully it will help them.
- Roll back to the previous CLI version using
-
repo owner - changed status to open
Reopening since this is happening to a second user for whom uninstall/reinstall does not resolve the issue.
-
repo owner It does not appear that this week's CLI build addresses the remaining issues that have been discussed here and in
#1606. I'll keep working with Salesforce to try to figure out what's going on and keep everyone posted here. For the time being, the same workarounds apply. -
I updated my sfdx cli version and now it seems to be working.
gemandala@Georges-MacBook-Pro ~ % sfdx --version sfdx-cli/7.58.2-937f666ed4 darwin-x64 node-v10.15.3 gemandala@Georges-MacBook-Pro ~ %
-
repo owner - changed status to resolved
Okay. That's nice to hear. I know that the Salesforce CLI team is working diligently to address these issues. Sounds like they took care of this one. I'll resolve this but don't hesitate to let me know if it comes back.
- Log in to comment
That looks like an issue with your Salesforce CLI installation. You could probably reproduce it by running the following from the command-line:
I would recommend that you completely uninstall and reinstall the CLI. Please let me know the outcome either way if you don't mind.