Coder Social home page Coder Social logo

sous-chefs / nodejs Goto Github PK

View Code? Open in Web Editor NEW
228.0 31.0 195.0 465 KB

Development repository for the nodejs cookbook

Home Page: https://supermarket.chef.io/cookbooks/nodejs

License: Apache License 2.0

Ruby 99.83% Shell 0.17%
chef-cookbook chef-resource chef nodejs hacktoberfest managed-by-terraform

nodejs's Introduction

Cookbook Version CI State OpenCollective OpenCollective License

Installs node.js/npm and includes a resource for managing npm packages

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • openSUSE
  • Windows

Note: Source installs require GCC 4.8+, which is not included on older distro releases

Chef

  • Chef Infra Client 15.3+

Cookbooks

  • ark

Usage

Include the nodejs recipe to install node on your system based on the default installation method:

include_recipe "nodejs"

Install methods

Package

Install node from packages:

node['nodejs']['install_method'] = 'package' # Not necessary because it's the default
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_package"

By default this will setup deb/rpm repositories from nodesource.com, which include up to date NodeJS packages. If you prefer to use distro provided package you can disable this behavior by setting node['nodejs']['install_repo'] to false.

Binary

Install node from official prebuilt binaries:

node['nodejs']['install_method'] = 'binary'
include_recipe "nodejs"

# Or
include_recipe "nodejs::nodejs_from_binary"

# Or set a specific version of nodejs to be installed
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['version'] = '5.9.0'
node.default['nodejs']['binary']['checksum'] = '99c4136cf61761fac5ac57f80544140a3793b63e00a65d4a0e528c9db328bf40'

# Or fetch the binary from your own location
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['binary']['url'] = 'https://s3.amazonaws.com/my-bucket/node-v7.8.0-linux-x64.tar.gz'
node.default['nodejs']['binary']['checksum'] = '0bd86f2a39221b532172c7d1acb57f0b0cba88c7b82ea74ba9d1208b9f6f9697'

Source

Install node from sources:

node['nodejs']['install_method'] = 'source'
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_source"

Chocolatey

Install node from chocolatey:

node['nodejs']['install_method'] = 'chocolatey'
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_chocolatey"

NPM

Npm is included in nodejs installs by default. By default, we are using it and call it embedded. Adding recipe nodejs::npm assure you to have npm installed and let you choose install method with node['nodejs']['npm']['install_method']

include_recipe "nodejs::npm"

Warning: This recipe will include the nodejs recipe, which by default includes nodejs::nodejs_from_package if you did not set node['nodejs']['install_method'].

Resources

npm_package

note: This resource was previously named nodejs_npm. Calls to that resource name will still function, but cookbooks should be updated for the new npm_package resource name.

npm_package lets you install npm packages from various sources:

  • npm registry:

    • name: property :package
    • version: property :version (optional)
  • url: property :url

    • for git use git://{your_repo}
  • from a json (package.json by default): property :json

    • use true for default
    • use a String to specify json file

Packages can be installed globally (by default) or in a directory (by using attribute :path)

You can specify an NPM_TOKEN environment variable for accessing NPM private modules by using attribute :npm_token

You can specify a NODE_ENV environment variable, in the case that some element of your installation depends on this by using attribute :node_env. E.g., using node-config as part of your postinstall script. Please note that adding the --production option will override this to NODE_ENV=production.

You can append more specific options to npm command with attribute :options array :

You can specify auto_update as false to stop the npm install command from running and updating an installed package. Running the command will update packages within restrictions imposed by a package.json file. The default behavior is to update automatically.

  • use an array of options (w/ dash), they will be added to npm call.
  • ex: ['--production','--force'] or ['--force-latest']

You can specify live_stream true for the resource to have the package install information included in the chef-client log outout for better npm package diagnostics and trouble shooting.

This LWRP attempts to use vanilla npm as much as possible (no custom wrapper).

Packages

npm_package 'express'

npm_package 'async' do
  version '0.6.2'
end

npm_package 'request' do
  url 'github mikeal/request'
end

npm_package 'grunt' do
  path '/home/random/grunt'
  json true
  user 'random'
  node_env 'staging'
end

npm_package 'my_private_module' do
  path '/home/random/myproject' # The root path to your project, containing a package.json file
  json true
  npm_token '12345-abcde-e5d4c3b2a1'
  user 'random'
  options ['--production'] # Only install dependencies. Skip devDependencies
end

Working Examples

Or add packages via attributes (which accept the same attributes as the LWRP above):

"nodejs": {
  "npm_packages": [
    {
      "name": "express"
    },
    {
      "name": "async",
      "version": "0.6.2"
    },
    {
      "name": "request",
      "url": "github mikeal/request"
    }
    {
      "name": "grunt",
      "path": "/home/random/grunt",
      "json": true,
      "user": "random"
    }
  ]
}

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

nodejs's People

Contributors

barthv avatar cosmonaut-ok avatar damacus avatar fnichol avatar gmccue avatar gmiroshnykov avatar grimm26 avatar guilhem avatar jeffbyrnes avatar julesau avatar kitchen-porter avatar margani avatar markgibbons avatar mburns avatar mdxp avatar meson10 avatar mmarod avatar paulrbr avatar pierrerambaud avatar ramereth avatar randytarampi avatar renovate[bot] avatar rohansingh avatar sax avatar steve-jansen avatar tas50 avatar thirumoorthir avatar xorima avatar xorimabot avatar zhmurko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs's Issues

npm LWRP

Must manage individual packages and packages.json

Is node installed as root

I'd rather install node under a user instead of root. Im looking at the code but I can't seem to see if the cookbook is installing node as a root user. If so I can create a pull request to install node/npm as a user.

404 when attempting to install node via binary

I am attempting to install from binary, specifying the version and getting the following error when converging in chef:

================================================================================
Error executing action `install` on resource 'ark[nodejs-binary]'
================================================================================


Chef::Exceptions::MultipleFailures
----------------------------------
Multiple failures occurred:
* Net::HTTPServerException occurred in chef run: remote_file[/tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz] (/tmp/kitchen/cookbooks/ark/providers/default.rb line 45) had an error: Net::HTTPServerException: 404 "Not Found"
       * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[unpack /tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz] (/tmp/kitchen/cookbooks/ark/providers/default.rb line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
       ---- Begin output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz --strip-components=1 ----
       STDOUT:
       STDERR: gzip: stdin: unexpected end of file
       /bin/tar: Child returned status 1
       /bin/tar: Error is not recoverable: exiting now
       ---- End output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz --strip-components=1 ----
       Ran /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz --strip-components=1 returned 2



       Resource Declaration:
       ---------------------

       # In /tmp/kitchen/cookbooks/nodejs/recipes/nodejs_from_binary.rb


        39: ark 'nodejs-binary' do
        40:   url nodejs_bin_url
        41:   version node['nodejs']['version']
        42:   checksum checksum
        43:   has_binaries ['bin/node', 'bin/npm']
        44:   action :install
        45: end

Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cookbooks/nodejs/recipes/nodejs_from_binary.rb:39:in `from_file'

       ark("nodejs-binary") do
         provider Chef::Provider::Ark
         action [:install]
         updated true
         updated_by_last_action true

         retries 0
         retry_delay 2
         guard_interpreter :default
         cookbook_name :nodejs
         recipe_name "nodejs_from_binary"
         url "http://nodejs.org/dist/v0.10.26/node-v0.10.28-linux-x64.tar.gz"
         version "0.10.28"
         checksum "305bf2983c65edea6dd2c9f3669b956251af03523d31cf0a0471504fd5920aac"
         has_binaries ["bin/node", "bin/npm"]
         extension "tar.gz"
         prefix_bin "/usr/local/bin"
         home_dir "/usr/local/nodejs-binary"
         path "/usr/local/nodejs-binary-0.10.28"
         release_file "/tmp/kitchen/cache/nodejs-binary-0.10.28.tar.gz"

         strip_components 1
         owner "root"
         group 0
       end

On a related note, is there a way to specify which version of NPM gets installed by hand with the binary/source method?

NPM install doesn't run if package is already installed

The install action is skipped due to the "not_if" clause in the provider. This makes it very difficult (impossible?) to upgrade packages just by using the install action, even with the --force option. The current workaround for me is to uninstall the package (which is skipped if it isn't installed) then install it.

Should we just remove the not_if installed clause? Or should there be a :force_install action?

Setting the nodejs engine to iojs and install_method to 'source' does not change the prefix_url

Hello,

I'm new to chef.. and I don't open many bugs bare with me....

my /cookbook/attributes/default.rb
default['nodejs']['engine'] = 'iojs'
default['nodejs']['version'] = '2.2.1'
default['nodejs']['source'] = { :checksum => '55e79cc4f4cde41f03c1e204d2af5ee4b6e4edcf14defc82e518436e939195fa' }
default['nodejs']['install_method'] = 'source'

Keeps creating this chef error:

  Error executing action `create` on resource 'remote_file[/var/chef/cache/iojs-source-2.2.1.tar.gz]'
  ================================================================================

Net::HTTPServerException
  ------------------------
  404 "Not Found"

  Resource Declaration:
  ---------------------
  # In /var/chef/cache/cookbooks/ark/providers/default.rb

  279:   remote_file new_resource.release_file do
  280:     Chef::Log.debug('DEBUG: new_resource.release_file')
  281:     source new_resource.url
  282:     checksum new_resource.checksum if new_resource.checksum
  283:     action :create
  284:     notifies :run, "execute[unpack #{new_resource.release_file}]"
  285:   end
  286: 

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/ark/providers/default.rb:279:in `block in class_from_file'

  remote_file("/var/chef/cache/iojs-source-2.2.1.tar.gz") do
    provider Chef::Provider::RemoteFile
    action [:create]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    path "/var/chef/cache/iojs-source-2.2.1.tar.gz"
    backup 5
    atomic_update true
    source ["http://nodejs.org/dist/v2.2.1/iojs-v2.2.1.tar.gz"]
    use_etag true
    use_last_modified true
    declared_type :remote_file
    cookbook_name "nodejs"
    checksum "55e79cc4f4cde41f03c1e204d2af5ee4b6e4edcf14defc82e518436e939195fa"
  end

Notice the source goes and fetch from the nodejs and not iojs server

If I override the prefix_url in my cookbook before load the include_recipe of "nodejs" with
node.override['nodejs']['prefix_url'] = 'http://iojs.org/dist/'

Then it works fine.

So I'm wondering if the
https://github.com/redguide/nodejs/blob/8fde9f58856c1243551ab9c2492c96bb420698ed/attributes/default.rb#L31

Works as intended?

Thanks,
Kyle

nodejs_npm with json is not idempotent

Running into an issue where using the nodejs_npm lwrp with a json (packages.json) file will run 'npm install' on every converge.

nodejs_npm 'node-app-name' do
  path '/path/to/app'
  json true
  user 'bill'
  group 'bill'
  version '1.2.3'
end

it appears that the LWRP only checks the package/version/path of individual node packages, as opposed to the "name" and "version" of the json project being installed and whether or not its dependencies have been satisfied.

Check to see if package installed should take into account user

I ran into a funny problem where npm always tried to install the package. After a bit of troubleshooting, I found out it was because the npm list command didn't run as the same user as the npm install command. This breaks when you have a prefix set.

For example, if I run "npm install -global " as the vagrant user, and my npmrc contains a prefix of ~/npm, it'll put the package there.

However on the next converge, it'll run "npm list -global -json" as the root user, so it won't find the package.

The resource.user param should be passed into the shell that executes npm list...

Release 2.1.0

PR count is too damn low 😅 .

Maybe it's time to release next version.
We'll have to check if quality/style/integration tests are enough before that.

Problem with installing nodejs on Centos 6.4

Hi,

Got a problem when trying to install my vagrant box (previously worked fine) on clean system

Host: Mac OS X 10.10
Guest: Centos 6.4
Cookbooks: nodejs only

Vagrant up log here:
http://pastebin.com/T6sNssYA

The issue is:
"Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again"
"[Errno 14] problem making ssl connection"

Used this article:
http://unix.stackexchange.com/questions/148144/unable-to-pull-epel-repository-metadata

"yum check-update" provides me the same error, however, when I run on box without installing nodejs cookbook, it works fine.

Any advices are appreciate.

Chef Supermarket cookbook outdated

The cookbook on the Chef Supermarket is confusing, it still points to the old nodejs repo but still lists the 2.0.0 version. Any way to get that to point to this one instead?

mburns maintainer request

Hi, I'd like to request becoming a maintainer of this cookbook to share the maintenance burden and help lower the response time for Issues and reviews on Pull Requests that come in from the community.

Is there a process for this in place(@guilhem)?

Cheers!

nodejs::nodejs_from_binary and nodejs_npm interaction unexpected and undesirable behavior

Hi, I encountered a strange side effect when using the nodejs::nodejs_from_binary recipe and then later using the nodejs_npm LWRP. After first invocation and completion of nodejs_npm, the nodejs::nodejs_from_package recipe gets called implicitly.

Here is a gist of what happens during my converge:
https://gist.github.com/smeinel/df8c0cdfe2373d532514

TL;DR version:

  • nodejs::nodejs_from_binary recipe is performed (lines 4-57)
  • nodejs_npm "uglify-js" is called (lines 77-85)
  • nodejs::nodejs_from_package recipe is performed (lines 88-101)
  • nodejs_npm "browserify" is called (lines 102-111)

If I set node['nodejs']['install_method'] = 'binary' then the nodejs::nodejs_from_package recipe invocation does not occur. This interaction is unexpected, and lead to a series of confusing bugs related to the expected state of the server's environment.

Part of this could perhaps be fixed by a documentation change warning people to explicitly set their install_method. However, the action of implicitly installing a different version of node and npm after performing a nodejs_npm call certainly should be considered a bug.

Error on debian 7.6

Hello,

I have the fallowing error on debian 7.6 / Vbox / Vagrant on the first run :

==> default: ================================================================================
==> default: Error executing action `install` on resource 'package[nodejs]'
==> default: ================================================================================
==> default:
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '100'
==> default: ---- Begin output of apt-cache policy nodejs ----
==> default: STDOUT:
==> default: STDERR: E: Malformed line 1 in source list /etc/apt/sources.list.d/node.js.list (dist parse)
==> default: E: The list of sources could not be read.
==> default: E: The package lists or status file could not be parsed or opened.

The problem is :

$ sudo cat /etc/apt/sources.list.d/node.js.list
deb     https://deb.nodesource.com/node  main

The attribute node['lsb']['codename'] is empty :/

Cannot install sailsjs on Vagrant with node 0.12.2 and npm 2.7.4

When trying to install sailsjs on a vagrant machine provisioned with chef-solo the process fails with this exception:

Mixlib::ShellOut::ShellCommandFailed - nodejs_npm[sails] (nodejs::npm_packages line 2) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[install NPM package sails] (/tmp/vagrant-chef/8dd057f72a2ebfa476b47e58636968fc/cookbooks/nodejs/providers/npm.rb line 6) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ''

node -v: 0.12.2
npm -v: 2.7.4

Installing from command line ( ssh-ed in the vagrant machine ) run successfully:

$ sudo npm install -g sails
...
$ echo $?
0

node.json

"run_list": [
    ...
    "nodejs",
    ...
  ],
  "nodejs": {
    "install_method": "binary",
    "version": "0.12.2",
    "repo": "https://deb.nodesource.com/node_0.12",
    "binary": {
      "checksum": {
        "linux_x64": "4e1578efc2a2cc67651413a05ccc4c5d43f6b4329c599901c556f24d93cd0508"
      }
    },
    "npm_packages": [
      { "name": "sails" },
      { "name": "grunt-cli" },
      { "name": "pm2" }
    ]
  }
}

Any hint on how to solve this? Same node.json with node 0.10.38 works fine.

Suse didn't work

I get since yesterday a error message.

Env:

  • Suse 11 SP3

Error:
ERROR: There are no nodejs packages for this platform; please use the source or binary method to install node

metadata.rb

depends "nodejs"

Cheffile

cookbook 'nodejs', '~>2.0.0'
cookbook 'nodejs'

I try several ways every time same error:

include_recipe "nodejs::nodejs_from_source"
include_recipe "nodejs::nodejs_from_binary"

i also try to set the install_method in my attributes/default.rb

default['nodejs']['install_method'] = 'binary'
default['nodejs']['install_method'] = 'source'

Suse has no package for nodejs.

Still using bundled npm even though installing other version

We're using the cookbook to install a specific Node version and a specific NPM version. However, it seems like the defined NPM version isn't used. Instead it uses the npm version bundled in the node package (which is 1.4.x).

In our recipe:

node.override['nodejs']['engine'] = 'node'
node.override['nodejs']['version'] = '0.10.38'
node.override['nodejs']['npm']['version'] = '2.7.6'

include_recipe 'nodejs::nodejs_from_binary'
include_recipe 'nodejs::npm_from_source'

After this, the symlink points to:

ubuntu:~$ ls -la /usr/local/bin/npm
lrwxrwxrwx 1 root root 40 Jun 22 15:55 /usr/local/bin/npm -> /usr/local/nodejs-binary-0.10.38/bin/npm

Which is an older version:

ubuntu:~$ npm -version
1.4.28

Is this expected behavior, or a potential bug?

Our current workaround is to "manually" replace the symlink afterwards, but that feels kind of ugly. 😒


Node.js Cookbook: 2.4.0
OS: Ubuntu 14.04
Chef: 11.14

Can't install key from keyserver when port 11371 is blocked.

Hello,

When installing nodejs from packege and the server is behind a firewall where port 11371, the recipe will fail to install the key.

This can be fixed if the --keyserver option gets the protocol and we set port 80, like this:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv C7917B12

Bump to version 2.4.3?

After submitting #107 to add support for private repos, I'd like to use this cookbook from my berkshelf without specifying master branch. Do you think you could release a new version with the npm private repo support added?

npm install bower with '-g' option runs 'npm install -g'

I'm trying to install the bower package using the -global switch in the resource. I have the following in my recipe:

nodejs_npm 'bower' do
  options ['-g']
end

I get this when I run the recipe:

         * nodejs_npm[bower] action install


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

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Expected process to exit with [0], but received '1'
             ---- Begin output of npm install  -g  ----
             STDOUT:
             STDERR: npm ERR! addLocal Could not install .
             npm ERR! Error: No version provided
             npm ERR!     at needVersion (/usr/lib/node_modules/npm/lib/cache.js:1244:40)
             npm ERR!     at /usr/lib/node_modules/npm/lib/cache.js:1112:10
             npm ERR!     at /usr/lib/node_modules/read-package-json/read-json.js:50:40
             npm ERR!     at final (/usr/lib/node_modules/read-package-json/read-json.js:317:17)
             npm ERR!     at then (/usr/lib/node_modules/read-package-json/read-json.js:124:33)
             npm ERR!     at /usr/lib/node_modules/read-package-json/read-json.js:299:40
             npm ERR!     at fs.js:272:14
             npm ERR!     at /usr/lib/node_modules/graceful-fs/graceful-fs.js:103:5
             npm ERR!     at Object.oncomplete (fs.js:108:15)
             npm ERR! If you need help, you may report this log at:
             npm ERR!     <http://github.com/isaacs/npm/issues>
             npm ERR! or email it to:
             npm ERR!     <[email protected]>

             npm ERR! System Linux 3.10.0-123.4.4.el7.x86_64
             npm ERR! command "node" "/usr/bin/npm" "install" "-g"
             npm ERR! cwd /var/www/discogs
             npm ERR! node -v v0.10.36
             npm ERR! npm -v 1.3.6
             npm ERR!
             npm ERR! Additional logging details can be found in:
             npm ERR!     /var/www/discogs/npm-debug.log
             npm ERR! not ok code 0
             ---- End output of npm install  -g  ----
             Ran npm install  -g  returned 1

Change the user that nodejs_npm runs under?

We're installing pm2 using nodejs_npm and it's complaining about installing it as a root user

             ##### PM2 INSTALLATION
             #
             #
             # As you run PM2 as root, to update PM2 automatically
             # you must add the --unsafe-perm flag.
             #
             #       $  npm install pm2 -g --unsafe-perm
             #
             # Else run the installation as a non root user

is there a way to change the user that is actually running the npm install using this lwrp?

Changelog

Any chance the changelog can get updated for the current 2.2 release up on the community site?

Thanks,
Tim

Upgrade to chef 12 produces checksum error

My recipe has:

node.set['nodejs']['install_method'] = 'source'
node.set['nodejs']['version'] = '0.10.33'

include_recipe "nodejs"
include_recipe "nodejs::npm"

When I run this I get:

  • ark[nodejs-source] action install_with_make
    • directory[/usr/local/nodejs-source-0.10.33] action create (up to date)
    • remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz] action create
===============================================================================
Error executing action `create` on resource 'remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz]'
===============================================================================

      Chef::Exceptions::ChecksumMismatch
      ----------------------------------
      Checksum on resource (ef5e4e) does not match checksum on content (75dc26)

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/ark/providers/default.rb

      279:   remote_file new_resource.release_file do
      280:     Chef::Log.debug('DEBUG: new_resource.release_file')
      281:     source new_resource.url
      282:     checksum new_resource.checksum if new_resource.checksum
      283:     action :create
      284:     notifies :run, "execute[unpack #{new_resource.release_file}]"
      285:   end
      286: 

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/ark/providers/default.rb:279:in `block in class_from_file'

      remote_file("/var/chef/cache/nodejs-source-0.10.33.tar.gz") do
        provider Chef::Provider::RemoteFile
        action [:create]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        path "/var/chef/cache/nodejs-source-0.10.33.tar.gz"
        backup 5
        atomic_update true
        source ["http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz"]
        use_etag true
        use_last_modified true
        declared_type :remote_file
        cookbook_name "nodejs"
        checksum "ef5e4ea6f2689ed7f781355012b942a2347e0299da0804a58de8e6281c4b1daa"
      end


===============================================================================
Error executing action `install_with_make` on resource 'ark[nodejs-source]'
===============================================================================

    Chef::Exceptions::ChecksumMismatch
    ----------------------------------
    remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz] (/var/chef/cache/cookbooks/ark/providers/default.rb line 279) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (ef5e4e) does not match checksum on content (75dc26)

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_source.rb

     36: ark 'nodejs-source' do
     37:   url nodejs_src_url
     38:   version node['nodejs']['version']
     39:   checksum node['nodejs']['source']['checksum']
     40:   make_opts ["-j #{node['nodejs']['make_threads']}"]
     41:   action :install_with_make
     42: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_source.rb:36:in `from_file'

    ark("nodejs-source") do
      provider Chef::Provider::Ark
      action [:install_with_make]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :ark
      cookbook_name "nodejs"
      recipe_name "nodejs_from_source"
      url "http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz"
      version "0.10.33"
      checksum "ef5e4ea6f2689ed7f781355012b942a2347e0299da0804a58de8e6281c4b1daa"
      make_opts ["-j 1"]
      extension "tar.gz"
      prefix_bin "/usr/local/bin"
      home_dir "/usr/local/nodejs-source"
      path "/usr/local/nodejs-source-0.10.33"
      release_file "/var/chef/cache/nodejs-source-0.10.33.tar.gz"
      strip_components 1
      owner "root"
      group 0
    end

Add idempotent LWRP for 'npm link'

It would be nice to have support for 'npm link' to manage linking a given version of an application to a specific location on disk. Additionally, adding this as a 'link' attribute to the existing nodejs_npm LWRP would be extremely useful.

Global installation of npm packages does not create executable in /usr/local/bin

System: Amazon Linux 2015.09
Chef: 11.10.4 (AWS OpsWorks)

When running the following

node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['version'] = '4.2.1'
include_recipe 'nodejs'
nodejs_npm 'bower'
nodejs_npm 'gulp'

As expected

  • node 4.2.1 is installed and which node returns /usr/local/bin/node
  • npm is installed and which npm returns /usr/local/bin/npm

Not as expected

  • bower and gulp are installed, I can see them in /usr/local/nodejs-binary-4.2.1/bin, however there is no executable in any of the default paths

As a result, when any user on the system tries to bower install bash fails with the error bower: command not found

Is this normal or an issue?
Do I have to specify a new path?
Is this because I've done a binary install instead of source or package?

Chef::Exceptions::Exec: package[npm]

Simple recipe:

include_recipe 'git'
include_recipe "nodejs"
include_recipe "nodejs::npm"

nodejs_npm 'express' do
  version '4.0.0'
end

And Chef crashes

[2014-04-16T09:37:22+00:00] INFO: *** Chef 10.14.2 ***
[2014-04-16T09:37:23+00:00] INFO: Setting the run_list to ["recipe[oauth-server]"] from JSON
[2014-04-16T09:37:23+00:00] INFO: Run List is [recipe[oauth-server]]
[2014-04-16T09:37:23+00:00] INFO: Run List expands to [oauth-server]
[2014-04-16T09:37:23+00:00] INFO: Starting Chef Run for precise64
[2014-04-16T09:37:23+00:00] INFO: Running start handlers
[2014-04-16T09:37:23+00:00] INFO: Start handlers complete.

================================================================================
Error executing action `install` on resource 'package[npm]'
================================================================================

Chef::Exceptions::Exec
----------------------
apt-get -q -y install npm=1.1.4~dfsg-1 returned 100, expected 0

Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nodejs/recipes/nodejs_from_package.rb

 25: node['nodejs']['packages'].each do |node_pkg|
 26:   package node_pkg
 27: end

Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nodejs/recipes/nodejs_from_package.rb:26:in `from_file'

package("npm") do
  retry_delay 2
  retries 0
  recipe_name "nodejs_from_package"
  action :install
  cookbook_name :nodejs
  package_name "npm"
end

[2014-04-16T09:37:23+00:00] ERROR: Running exception handlers
[2014-04-16T09:37:23+00:00] ERROR: Exception handlers complete
[2014-04-16T09:37:23+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-04-16T09:37:23+00:00] FATAL: Chef::Exceptions::Exec: package[npm] (nodejs::nodejs_from_package line 26) had an error: Chef::Exceptions::Exec: apt-get -q -y install npm=1.1.4~dfsg-1 returned 100, expected 0
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

add --production

By default, npm install will install all modules listed as dependencies. With the --production flag, npm will not install modules listed in devDependencies.

@guilhem

Problem with npm install from package.json

I want to provision a VM using vagrant and chef-solo.

I have a package.json file in a folder /var/www.
When I do this in my recipe

nodejs_npm 'main' do
  path '/var/www'
  json true
end

I end up with this error:

==> default:       ================================================================================
==> default:       Error executing action `run` on resource 'execute[install NPM package main]'
==> default:       ================================================================================
==> default:
==> default:       Mixlib::ShellOut::ShellCommandFailed
==> default:       ------------------------------------
==> default:       Expected process to exit with [0], but received ''
==> default:       ---- Begin output of npm install   ----
==> default:       STDOUT:
==> default:       STDERR:
==> default:       ---- End output of npm install   ----

When I add every dependency from my package.json individually to my recipe like this

nodejs_npm 'node-sass' do
  path '/var/www'
end

and so on, everything works fine. Also, when I don't do any npm installing in my recipe at all, and just do it manually afterwards, everything also works fine and I get an exit code 0.

npm: 3.5.2
node: 5.3.0

Any ideas?

Using `nodejs_npm` from Another Cookbook?

Hi -

Using my_cookbook, I'd like to use redguide/nodejs in order to download npm packages.

Here's what I tried:

Berksfile
cookbook 'nodejs', git: 'https://github.com/redguide/nodejs.git'

cookbooks/my_cookbook/recipes/default.rb

include_recipe "nodejs::npm"

packages = node['my_cookbook']['packages_to_install']

if packages.nil? | packages.empty? then
    raise "node['my_cookbook']['packages_to_install'] is nil or empty"
end

install_path = node['my_cookbook']['path']

packages.each do |package|
    nodejs_npm package do
        path install_path
    end
end

cookbooks/my_cookbook/metadata.rb
depends 'nodejs::npm'

How can I properly use your cookbook for installing npm packages?

Install npm_from_source failing with custom version

Found a new issue. This one has to do with customizing the version of npm to install. Here are the actions I am taking:

node.default['nodejs']['npm']['install_method'] = 'source'
node.default['nodejs']['npm']['version'] = '1.4.21'
include_recipe "nodejs::npm_from_source"

And here is the chef-client output that is failing. I will investigate more when I have a chance but just wanted to make sure it's not something silly that I am missing.

================================================================================       
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/me-retaliator/recipes/default.rb       
================================================================================       

ArgumentError       
-------------       
wrong number of arguments (2 for 1)       

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:10:in `npm_dist'
         /tmp/kitchen/cache/cookbooks/nodejs/recipes/npm_from_source.rb:25:in `from_file'
         /tmp/kitchen/cache/cookbooks/me-retaliator/recipes/default.rb:8:in `from_file'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/nodejs/libraries/nodejs_helper.rb:

         3:      def npm_dist
         4:        if node['nodejs']['npm']['url']
         5:          return { 'url' => node['nodejs']['npm']['url'] }
         6:        else
         7:  
         8:          require 'open-uri'
         9:          require 'json'
        10>>         result = JSON.parse(URI.parse("https://registry.npmjs.org/npm/#{node['nodejs']['npm']['version']}", :max_nesting => false
).read)
        11:          ret = { 'url' => result['dist']['tarball'], 'version' => result['_npmVersion'], 'shasum' => result['dist']['shasum'] }
        12:          Chef::Log.debug("Npm dist #{ret}")
        13:          return ret
        14:        end
        15:      end
        16:  
        17:      def install_not_needed?
        18:        cmd = Mixlib::ShellOut.new("#{node['nodejs']['node_bin']} --version")
        19:        version = cmd.run_command.stdout.chomp

2.0.0 release

Sorry to create an issue for this, but when do you expect 2.0.0 to be available?

Thanks!

Broken nodejs::npm_from_source in 2.3

Hi, juste updated to 2.3 and the install of npm from source is broken when it does the make install:

node: command not found

I fixed it for now by installing 'nodejs-legacy'.

I don't know if it's worth it's own bug report, but 'ark' is idempotent on it's source, so because the source were already downloaded, running chef didn't reinstall properly npm. Maybe you could add something like this ? :

creates '/usr/local/bin/npm'

Thanks.

Cannot install npm modules

Hello! I've starting using this cookbook but I'm facing a problem that I wasn't able to overcome.

I'm using a vagrant machine ( box is ubuntu/trusty64 ). Everything works except for npm module installation.

This is the excerpt from mi node.json file ( loaded by chef-solo ):

{
  "run_list": [
    "nodejs::npm", [...]
  ],
  "nodejs": {
    "npm_packages": [
      { "name": "sails" },
      { "name": "grunt-cli" }
    ]
  },
  {...}
}

What am I doing wrong? I want to install sails and grunt-cli module globally.

Thanks for your help

2.3.0 Fails on installation of npm

Hi,

I'm getting the following after upgrading to 2.3.0. Reverting back to 2.2.0 corrects the issue.
I'm including the following recipes, and not overriding any attributes.

include_recipe "nodejs::nodejs_from_package"
include_recipe "nodejs::npm"

chef-client output:

Recipe: nodejs::nodejs_from_package
  * apt_package[nodejs] action install (up to date)
  * apt_package[npm] action install


================================================================================
    Error executing action `install` on resource 'apt_package[npm]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '100'
    ---- Begin output of apt-get -q -y install npm=1.3.10~dfsg-1 ----
    STDOUT: Reading package lists...
    Building dependency tree...
    Reading state information...
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
     npm : Depends: nodejs but it is not going to be installed
           Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
           Depends: node-ansi but it is not going to be installed
           Depends: node-archy but it is not going to be installed
           Depends: node-block-stream but it is not going to be installed
           Depends: node-fstream (>= 0.1.22) but it is not going to be installed
           Depends: node-fstream-ignore but it is not going to be installed
           Depends: node-github-url-from-git but it is not going to be installed
           Depends: node-glob (>= 3.1.21) but it is not going to be installed
           Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
           Depends: node-inherits but it is not going to be installed
           Depends: node-ini (>= 1.1.0) but it is not going to be installed
           Depends: node-lockfile but it is not going to be installed
           Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
           Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
           Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
           Depends: node-gyp (>= 0.10.9) but it is not going to be installed
           Depends: node-nopt (>= 2.1.1) but it is not going to be installed
           Depends: node-npmlog but it is not going to be installed
           Depends: node-once but it is not going to be installed
           Depends: node-osenv but it is not going to be installed
           Depends: node-read but it is not going to be installed
           Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
           Depends: node-request (>= 2.25.0) but it is not going to be installed
           Depends: node-retry but it is not going to be installed
           Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
           Depends: node-semver (>= 2.1.0) but it is not going to be installed
           Depends: node-sha but it is not going to be installed
           Depends: node-slide but it is not going to be installed
           Depends: node-tar (>= 0.1.18) but it is not going to be installed
           Depends: node-which but it is not going to be installed
    STDERR: E: Unable to correct problems, you have held broken packages.
    ---- End output of apt-get -q -y install npm=1.3.10~dfsg-1 ----
    Ran apt-get -q -y install npm=1.3.10~dfsg-1 returned 100

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_package.rb

     32:   package node_pkg
     33: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_package.rb:32:in `block in from_file'

    apt_package("npm") do
      action :install
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      package_name "npm"
      version "1.3.10~dfsg-1"
      timeout 900
      declared_type :package
      cookbook_name "nodejs"
      recipe_name "nodejs_from_package"
    end

How to Specify URLs for Installing Node, NPM, and NPM libs?

Could you please tell me how to:

1 specify a URL for installing node
--> Example: node['nodejs']['node']['url'] = '....' 2. specify a URL for installing npm --> Example:node['nodejs']['npm']['url'] = '....'
3. specify a URL for installing a particular npm library
--> I presume that I would specify this command within my actual cookbook's recipe, which uses your nodejs resource
I read through your docs, but got lost in the term LWRP.

Thank you (and thanks for this cookbook).

Install a binary from a cached file option?

Hey, is there an option to install a nodejs binary from an already downloaded file, not without downloading it each time from a remote url? It would definitely save time.

npm_source test suite fails in test kitchen for cent os 6.6

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
']
>>>>>> ----------------------

nodejs::repo recipe timing out to keyserver for ubuntu

I've been trying to work around this issue, but since the keyserver is hard-coded to 'keyserver.ubuntu.com' there isn't much else I can manipulate. I get the following when I try installing the statsd cookbook, which has a dependency on the nodejs::repo recipe:

  * apt_repository[node.js] action add[2014-10-27T15:51:36+00:00] INFO: Processing apt_repository[node.js] action add (nodejs::repo line 7)

* execute[install-key 1655a0ab68576280] action run[2014-10-27T15:51:36+00:00] INFO: Processing execute[install-key 1655a0ab68576280] action run     (/var/chef/cache/cookbooks/apt/providers/repository.rb line 28)


  ================================================================================
  Error executing action `run` on resource 'execute[install-key 1655a0ab68576280]'
  ================================================================================

      Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/apt/providers/repository.rb:28:in `install_key_from_keyserver'

  execute("install-key 1655a0ab68576280") do
    action [:run]
    retries 0
    retry_delay 2
    guard_interpreter :default
    command "apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280"
    backup 5
    returns 0
    cookbook_name "nodejs"
    not_if { #code block }
  end

[2014-10-27T15:53:37+00:00] ERROR: apt_repository[node.js] (nodejs::repo line 7) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[install-key 1655a0ab68576280]     (/var/chef/cache/cookbooks/apt/providers/repository.rb line 28) had an error:        Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 ----
STDOUT: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir    /tmp/tmp.DbsjrjcUlu --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-   keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280
STDERR: gpg: requesting key 68576280 from hkp server keyserver.ubuntu.com
gpg: keyserver timed out 
gpg: keyserver receive failed: keyserver error
---- End output of apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 ----
Ran apt-key adv --keyserver keyserver.ubuntu.com --recv 1655a0ab68576280 returned 2
[2014-10-27T15:53:37+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited    unsuccessfully (exit code 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.