Closed miklb closed 7 years ago
i'll do some tests and see what i can find!
@miklb, a couple questions to gain the info i need to debug further:
You're running on macOS, yes? can you run the command: command -v wp
and paste the response?
Also, can you check activity monitor while atom is running and confirm what user the atom process is attached to?
Lastly, do you happen to know if homebrew automatically adds the wp-cli to your PATH variable? and is that via your .bash_profile?
Yes, macOS 10.12.3
WP CLI installed via homebrew
~> brew --version
Homebrew 1.1.11
Homebrew/homebrew-core (git revision ba5d; last commit 2017-03-09)
~> wp --version
WP-CLI 1.1.0
~> which wp
/usr/local/bin/wp
Atom user in Activity Monitor is my user
I don't recall if it automatically adds to my path, but I do have the path set in my ZSH profile. I can refresh my memory on that if you need.
Thanks for looking into this.
Thanks for the additional details @miklb. Can you just confirm that command -v wp
returns the path to wpcli? That is the command the package uses to determine that wpcli is installed. My guess is that it will return the path correctly and the issue lies somewhere in how atom executes the child_process.exec command which i am looking into. Hopefully i can have a fix here shortly!
~> command -v wp
/usr/local/bin/wp
returns same info as which wp
Again, very appreciative of you investigating this.
@peterjohnhunt fwiw, I've used several packages that have an option field to add a custom path to a required executable. linter-phpcs is one such package.
Good thought, thanks! Getting a website project live this week, but hoping to be able to put in an hour or two to it by end of the week!
No worries, and if you need any kind of testing, I'm sure I can install a beta package via apm
. At least I've seen instructions for doing so 😉
Haha! Feel free to install the beta! It's much better and pretty stable. Only one existing bug keeping me from releasing it. Lots more wp-cli functionality though (which won't help you till I fix this ticket ;) )
@peterjohnhunt curious if you have thought anymore about this?
@miklb,
Sorry for the delay on this! just pushed up a path-debugging
branch to the repo. Any chance you can git clone
down, git checkout path-debugging
and apm link
to test?
When adding a Wordpress site it should log the $PATH string in atom's console log (CMD+ALT+I to view). Trying to see what Atom is running as and why it's not seeing the /usr/local/bin/wp
when attempting to call the command.
I'm using the node-wp-cli package which uses the child_process.exec function to run the wp cli commands. For some reason, when atom runs these commands it must be using a separate path or something. Hoping this will help us debug!
Error: Cannot find module 'wp-cli'
at Module._resolveFilename (module.js:455:15)
at Module._resolveFilename (/Applications/Atom.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app.asar/src/module-cache.js:383:52)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wpcli.coffee:2:6)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wpcli.coffee:1:1)
at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:109:30)
at Object.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:216:21)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wordpress.coffee:2:9)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wordpress.coffee:1:1)
at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:109:30)
at Object.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:216:21)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wordpress-suite.coffee:1:13)
at Object.<anonymous> (/Users/miklb/Tools/wordpress-suite/lib/wordpress-suite.coffee:1:1)
at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:109:30)
at Object.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:216:21)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
at Package.module.exports.Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:796:27)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:123:28
at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:96:15)
at Package.module.exports.Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:110:12)
at PackageManager.module.exports.PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:468:14)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:412:19
at Config.module.exports.Config.transact (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:312:16)
at PackageManager.module.exports.PackageManager.loadPackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:407:19)
at /Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:792:28
Wasn't sure where to look in console, but get that stack trace error even before adding a project folder that has WP.
Can you actually do a apm install
which will download the dependencies.
ah, sorry.
Yeah, console gives me this error
PATH: /usr/bin:/bin:/usr/sbin:/sbin
And as a reminder, homebrew installs at usr/local/bin/wp
@miklb in terminal, can you do a sudo nano /etc/paths
and add usr/local/bin
to the top of the file? If you're not familiar with nano you can type it in and then hit ctrl+x
and then hit y
to save
@peterjohnhunt I checked, and usr/local/bin
is already in /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
One thing to note, I do use zsh.
Looking around, it looks like we aren't the only ones where the global $PATH variable isn't correctly being inherited by the atom process (hence why it can't find the wp command). Just for a sanity check for me, what version of atom are you using?
also, could you try quitting atom and then opening terminal and running atom .
and see if the package finds wp-cli correctly?
Atom version 1.16.0
atom .
from terminal seems to work, no error when starting up.
it appears they are trying to fix this inconsistent issue within core #4126. I'm going to close this ticket for now since it appears that is the primary issue. Thanks for all the help debugging @miklb 👍
No, thank you for taking the time to debug. Looking forward to a better dev environment with your tool. Cheers.
At least that's what I'm assuming, as when I open a project I get a pop-up message saying wp-cli is not installed, though I know it is.
If I call
--info
in a project directory, it recognizes the localwp-cli.yml
file just fine.If it isn't an issue with the path, any suggestions greatly appreciated.
Thanks in advance!