Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

cannot spawn puppet-lint ENOENT #17

Closed
quaintance opened this issue Sep 2, 2015 · 18 comments
Closed

cannot spawn puppet-lint ENOENT #17

quaintance opened this issue Sep 2, 2015 · 18 comments
Labels

Comments

@quaintance
Copy link

since going to 0.5.0 the package is unable to call puppet-lint:
activate linter-erb
index.js:46 Window load time: 3113ms
events.js:141 Uncaught Error: spawn c:\tools\ruby200\bin\puppet-lint ENOENT
events.js:141 Uncaught Error: spawn c:\tools\ruby200\bin\puppet-lint ENOENT
2events.js:141 Uncaught Error: spawn puppet-lint ENOENT

this is windows 7, puppet-lint is in windows path, works fine from powershell, worked fine in previous versions of the package. I did have the path to puppet-lint explicitly configured in config.cson but have since removed that - doesn't seem to matter either way. clearly it's finding it, it just cannot execute it anymore, any ideas?

@quaintance
Copy link
Author

resolved this by setting executablePath to puppet-lint.bat, so for whatever reason in either the new package or maybe something about one of my later atom updates causing some issue that now it needs to use the batch file wrapper which calls the shell script explicitly with ruby.exe:

@echo OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/tools/ruby200/bin/puppet-lint" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*

@dieterdemeyer
Copy link

I'm also getting this error on Mac OS X with Atom version: 1.0.11

@ram-devsecops
Copy link

I am getting same error on windows 7 with atom version: 1.0.11

'puppet-lint' could not be spawned. Is it installed and on your path?

Uncaught Error: spawn puppet-lint ENOENT

@ram-devsecops
Copy link

I added the puppet-lint.bat executable path to config.cson, it doesn't show the error anymore.
But I don't see the puppet-lint warnings or errors for puppet files in the editor..how to fix this?

@DevOpsFu
Copy link

Another victim of this here. The issue seems to be related (or at least very similar) to this issue in node where spawn ignores the PATHEXT variable and therefore doesn't invoke puppet-lint.bat:

nodejs/node-v0.x-archive#2318

@DevOpsFu
Copy link

Until a fix is found, downgrading the packages has got me working again:

apm install linter@1.2.4
apm install linter-puppet-lint@0.2.9

@mafredri
Copy link

It looks like there are now two config entries (not sure if there was before) for the puppet lint executable, I managed to resolve this issue by changing the settings:

Before:

After:

@rafitadiaz rafitadiaz added the bug label Sep 24, 2015
@rafitadiaz
Copy link
Contributor

I tried to reproduce this bug on my linux and I couldn't. I'll try to get a windows box to reproduce it this weekend.
@mafredri Anyway the duplicate box in the setting will be fixed.

@DevOpsFu
Copy link

@rafitadiaz It's due to the fact that the spawn() call doesn't invoke scripts on Windows - https://www.npmjs.com/package/win-spawn is a shim for this exact issue.

@janorn
Copy link

janorn commented Oct 26, 2015

Any progress on this? Running OSX and bitten by this bug.

@deesto
Copy link

deesto commented Oct 30, 2015

@janorn me too, after upgrading OS X to 10.11.1 and Atom to 1.1.0, with all plugins updated including Linter.
Uncaught Error: spawn puppet-lint ENOENT

Puppet-Lint is installed and accessible:
$ puppet-lint --version
puppet-lint 1.1.0

@deesto
Copy link

deesto commented Nov 4, 2015

@janorn, @dieterdemeyer, all: see @mafredri's work-around to explicitly set your puppet-lint executable path in the plugin settings. This works for me, but the plugin really should be fixed: this path is certainly in my $PATH.

@janorn
Copy link

janorn commented Nov 5, 2015

This does not work for me. I have already tried it.

Uncaught BufferedProcessError: Failed to spawn command /Users/XXXX/.rvm/bin/puppet-lint . Make sure /Users/XXXX/.rvm/bin/puppet-lint is installed and on your PATH

$ ls -l /Users/XXXX/.rvm/bin/puppet-lint 
lrwxr-xr-x  1 XXXX  staff  63 24 Jun  2014 /Users/XXXX/.rvm/bin/puppet-lint -> /Users/XXXX/.rvm/wrappers/ruby-1.9.3-p547@vagrant/puppet-lint
$ ls -l /Users/XXXX/.rvm/wrappers/ruby-1.9.3-p547@vagrant/puppet-lint
-rwxr-xr-x  1 XXXX  staff  326 26 Okt 14:49 /Users/XXXX/.rvm/wrappers/ruby-1.9.3-p547@vagrant/puppet-lint
$ /Users/XXXX/.rvm/wrappers/ruby-1.9.3-p547@vagrant/puppet-lint --version
puppet-lint 1.1.0

@janorn
Copy link

janorn commented Nov 13, 2015

Wiping atom cson config file. And pasting in the suggested config from the wiki made it start working again.

@paul-krohn
Copy link

There are 2 issues here.

  • puppet-lint isn't in your $PATH unless it happens to be at /usr/bin/puppet-lint. Workaround: put the full path in executablePath
  • specifying the full path to an rvm-installed puppet-lint doesn't work, because rvm installs executables with #!/usr/bin/env ruby_executable_hooks as the shbang line; ruby_executable_hooks is a shell function, not an executable. Workarounds: install puppet-lint as a system gem, or modify the shbang line to #!/usr/bin/env ruby

@janorn
Copy link

janorn commented Dec 14, 2015

@paul-krohn it sure is in my PATH. All of my rvm installed gems are in my path.
The solution here is not to install it as root, which i detest, but much simpler point it at the wrapped rvm version. I figured it must have had something todo with the rvm install.

cat ~/.rvm/wrappers/ruby-1.9.3-p547@vagrant/puppet-lint
#!/usr/bin/env bash

if
  [[ -s "/Users/XXXX/.rvm/gems/ruby-1.9.3-p547@vagrant/environment" ]]
then
  source "/Users/XXXX/.rvm/gems/ruby-1.9.3-p547@vagrant/environment"
  exec puppet-lint "$@"
else
  echo "ERROR: Missing RVM environment file: '/Users/XXXX/.rvm/gems/ruby-1.9.3-p547@vagrant/environment'" >&2
  exit 1
fi

@adam-moss
Copy link

I have the same issue in OSX where puppet-lint is installed to /usr/local/bin. The workaround of hardcoding the full path to the executable works fine.

For reference:

gem installation:
gem install --user-install --no-document --bindir /usr/local/bin puppet-lint

/etc/paths:
/usr/local/bin /usr/bin /bin /usr/sbin /sbin

path:
/Users/user.name/.nvm/versions/node/v5.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
(node is sourced via the nvm script in my .bash_profile)

@steelbrain had a similar issue in steelbrain/linter#726

@Arcanemagus
Copy link
Member

@adam-moss that's just a part of running on OS X and Apple's "interesting" choice of giving applications launched from the GUI an empty environment. Workarounds for that are planned in Atom itself, and over in steelbrain/atom-linter#62.

I'm going to mark this as closed since from what I can tell every case reported has been a configuration issue and not an issue with linter-puppet-lint itself.

If anyone is having an issue running it that doesn't fall into one of these categories please comment further or better yet file a new issue 😉.

  • Running Atom on OS X through the GUI without fully specifying the path
  • Running puppet-lint through rvm and not using the wrapper (Thanks @janorn!)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests