sous-chefs/nodejs

npm_source test suite fails in test kitchen for cent os 6.6

medyagh opened this issue · 4 comments

When I try to converge npm_source test suite from kitchen.yaml (default kitchen comes with the cookbook except I use centos6.6)

here is the full error:

kitchen converge npm-source-c

-----> Starting Kitchen (v1.4.2)
-----> Converging <npm-source-centos66-vagrant>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 3.1.4...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (11.18.12-1)
       Transferring files to <npm-source-centos66-vagrant>
       Starting Chef Client, version 11.18.12
       Creating a new client identity for npm-source-centos66-vagrant using the validator key.
       resolving cookbooks for run list: ["nodejs::npm", "nodejs_test::npm"]
       Synchronizing Cookbooks:
         - nodejs
         - nodejs_test
         - yum-epel
         - build-essential
         - ark
         - apt
         - homebrew
         - git
         - yum
         - 7-zip
         - windows
         - dmg
         - chef_handler
       Compiling Cookbooks...
       /tmp/kitchen/cache/cookbooks/homebrew/libraries/homebrew_package.rb:26: warning: toplevel constant Homebrew referenced by Chef::Provider::Package::Homebrew
       Converging 16 resources
       Recipe: yum-epel::default


             - update content in file /etc/yum.repos.d/epel.repo from 7e2359 to d02c1f
             --- /etc/yum.repos.d/epel.repo 2015-04-21 16:37:33.000000000 -0500
             +++ /tmp/chef-rendered-template20160209-4040-wtd1nl    2016-02-09 12:01:21.450893371 -0600
             @@ -1,7 +1,11 @@
             +# This file was generated by Chef
             +# Do NOT modify this file by hand.
             +
       [epel]
       name=Extra Packages for Enterprise Linux 6 - $basearch
             -baseurl=http://centos-mirror.acdc.stack.targetnpe.com/epel/$releasever/$basearch/
       enabled=1
             +failovermethod=priority
       gpgcheck=1
             -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
             +gpgkey=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6


             - execute yum clean metadata --disablerepo=* --enablerepo=epel

             - execute yum -q -y makecache --disablerepo=* --enablerepo=epel
           * ruby_block[yum-cache-reload-epel] action create

           * execute[yum clean metadata epel] action nothing (skipped due to action :nothing)
           * execute[yum-makecache-epel] action nothing (skipped due to action :nothing)
           * ruby_block[yum-cache-reload-epel] action nothing (skipped due to action :nothing)

       Recipe: nodejs::nodejs_from_package

           - install version 0.10.36-3.el6 of package nodejs

           - install version 0.10.36-3.el6 of package nodejs-devel

           - install version 1.3.6-5.el6 of package npm
       Recipe: nodejs::npm_from_source

           * directory[/usr/local/npm-3.7.1] action create

           * remote_file[/tmp/kitchen/cache/npm-3.7.1.tgz] action create

             - update content in file /tmp/kitchen/cache/npm-3.7.1.tgz from none to 3d86ee
             (new content is binary, diff output suppressed)
           * execute[unpack /tmp/kitchen/cache/npm-3.7.1.tgz] action nothing (skipped due to action :nothing)
           * execute[set owner on /usr/local/npm-3.7.1] action nothing (skipped due to action :nothing)
           * execute[autogen /usr/local/npm-3.7.1] action nothing (skipped due to action :nothing)
           * execute[configure /usr/local/npm-3.7.1] action nothing (skipped due to action :nothing)
           * execute[make /usr/local/npm-3.7.1] action nothing (skipped due to action :nothing)
        (skipped due to action :nothing)
           * execute[unpack /tmp/kitchen/cache/npm-3.7.1.tgz] action run
             - execute /bin/tar xzf /tmp/kitchen/cache/npm-3.7.1.tgz --strip-components=1
           * execute[set owner on /usr/local/npm-3.7.1] action run
             - execute chown -R root:0 /usr/local/npm-3.7.1
           * execute[autogen /usr/local/npm-3.7.1] action run (skipped due to only_if)

             - execute ./configure 

             - execute make 

             - execute make install 

       Recipe: git::package
         * git_client[default] action install

             - install version 1.7.1-3.el6_4.1 of package git

       Recipe: nodejs_test::npm

           - create user random
         * nodejs_npm[express] action install


             ================================================================================
             Error executing action `run` on resource 'execute[install NPM package express]'
             ================================================================================

             JSON::ParserError
             -----------------
             A JSON text must at least contain two octets!

             Cookbook Trace:
             ---------------
             /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:25:in `npm_list'
             /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:39:in `npm_package_installed?'
             /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb:37:in `package_installed?'
             /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb:12:in `block (3 levels) in class_from_file'

             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb

        6:   execute "install NPM package #{new_resource.name}" do
        7:     cwd new_resource.path
        8:     command "npm install #{npm_options}"
        9:     user new_resource.user
       10:     group new_resource.group
       11:     environment npm_env_vars
       12:     not_if { package_installed? }
       13:   end
       14: end

             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb:6:in `block in class_from_file'

             execute("install NPM package express") do
        action "run"
        retries 0
        retry_delay 2
        guard_interpreter :default
        command "npm install  -global express"
        backup 5
        returns 0
        cookbook_name "nodejs_test"
        not_if { #code block }
             end


           ================================================================================
           Error executing action `install` on resource 'nodejs_npm[express]'
           ================================================================================

           JSON::ParserError
           -----------------
           execute[install NPM package express] (/tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb line 6) had an error: JSON::ParserError: A JSON text must at least contain two octets!

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:25:in `npm_list'
           /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:39:in `npm_package_installed?'
           /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb:37:in `package_installed?'
           /tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb:12:in `block (3 levels) in class_from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/nodejs_test/recipes/npm.rb

             9: nodejs_npm 'express'
            10: 

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/nodejs_test/recipes/npm.rb:9:in `from_file'

           nodejs_npm("express") do
             action :install
             retries 0
             retry_delay 2
             guard_interpreter :default
             cookbook_name "nodejs_test"
             recipe_name "npm"
             package "express"
           end


       Running handlers:
       [2016-02-09T12:02:51-06:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-02-09T12:02:51-06:00] ERROR: Exception handlers complete
       [2016-02-09T12:02:51-06:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 19 resources updated in 97.732857038 seconds
       [2016-02-09T12:02:51-06:00] ERROR: nodejs_npm[express] (nodejs_test::npm line 9) had an error: JSON::ParserError: execute[install NPM package express] (/tmp/kitchen/cache/cookbooks/nodejs/providers/npm.rb line 6) had an error: JSON::ParserError: A JSON text must at least contain two octets!
       [2016-02-09T12:02:51-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <npm-source-centos66-vagrant>.
>>>>>> Please see .kitchen/logs/npm-source-centos66-vagrant.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '

sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889
']
>>>>>> ----------------------

Same error trying to install mongoose package on a vagrant centOS box running chef-solo

Error executing action `install` on resource 'nodejs_npm[mongoose]'
================================================================================


JSON::ParserError
-----------------
execute[install NPM package mongoose] (/var/chef/cache/cookbooks/nodejs/providers/npm.rb line 6) had an error: JSON::ParserError: A JSON text must at least contain two octets!


Cookbook Trace:
---------------
/var/chef/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:25:in `npm_list'
/var/chef/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:39:in `npm_package_installed?'
/var/chef/cache/cookbooks/nodejs/providers/npm.rb:37:in `package_installed?'
/var/chef/cache/cookbooks/nodejs/providers/npm.rb:12:in `block (3 levels) in class_from_file'


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/ecosis_symon/recipes/inst_mean.rb

 57:   nodejs_npm upkg do
 58:     path "/appserv/symon/#{node['ecosis_symon']['inst_mean']['symonappname']}"
 59:     user "symon"
 60:   end
 61: end



Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/ecosis_symon/recipes/inst_mean.rb:57:in `block in from_file'

nodejs_npm("mongoose") do
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  cookbook_name "ecosis_symon"
  recipe_name "inst_mean"
  path "/appserv/symon/my_local_app"
  user "symon"
  package "mongoose"
end

Running handlers:
[2016-06-24T16:47:33+02:00] ERROR: Running exception handlers
Running handlers complete

[2016-06-24T16:47:33+02:00] ERROR: Exception handlers complete
[2016-06-24T16:47:33+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 22 resources updated in 228.378620124 seconds
[2016-06-24T16:47:33+02:00] ERROR: nodejs_npm[mongoose] (ecosis_symon::inst_mean line 57) had an error: JSON::ParserError: execute[install NPM package mongoose] (/var/chef/cache/cookbooks/nodejs/providers/npm.rb line 6) had an error: JSON::ParserError: A JSON text must at least contain two octets!
[2016-06-24T16:47:33+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)```

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

We could add a test case for this install and see if the problem still exists. Centos 6 is on the way out. See if this issue exists in other OS versions.

The build works in centos8 and ubuntu. Closing due to the support status of centos 6.