NPM install error using Ansible, works manually

I added a couple rules in my main.yml for deploy per the comments in the file.

project_post_build_commands:
  - cmd: "composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts"
  - path: web/app/themes/sage
    cmd: bower install
  - path: web/app/themes/sage
    cmd: npm install && gulp --production

bower install seems to work fine, but running npm install fails with the error below. However, when I ssh to the server, enter that directory and run npm install manually, everything works fine? Anyone else experience this? I will add that I followed the instructions in the npm debugging thread to no avail.

Notice this line, 39 http 404 https://registry.npmjs.org/%26%26. Is that a 404 error on some bogus URL?

25 silly lockFile 72f4391e-gulp gulp@
26 verbose lock gulp@ /home/deploy/.npm/72f4391e-gulp.lock
27 silly addNameRange { name: '&&', range: '*', hasData: false }
28 silly addNameRange { name: 'gulp', range: '*', hasData: false }
29 verbose url raw &&
30 verbose url resolving [ 'https://registry.npmjs.org/', './%26%26' ]
31 verbose url resolved https://registry.npmjs.org/%26%26
32 info trying registry request attempt 1 at 11:57:01
33 http GET https://registry.npmjs.org/%26%26
34 verbose url raw gulp
35 verbose url resolving [ 'https://registry.npmjs.org/', './gulp' ]
36 verbose url resolved https://registry.npmjs.org/gulp
37 info trying registry request attempt 1 at 11:57:01
38 http GET https://registry.npmjs.org/gulp
39 http 404 https://registry.npmjs.org/%26%26
40 silly registry.get cb [ 404,
40 silly registry.get   { 'content-type': 'application/json',
40 silly registry.get     'cache-control': 'max-age=0',
40 silly registry.get     'content-length': '62',
40 silly registry.get     'accept-ranges': 'bytes',
40 silly registry.get     date: 'Sun, 20 Sep 2015 16:57:01 GMT',
40 silly registry.get     via: '1.1 varnish',
40 silly registry.get     age: '0',
40 silly registry.get     connection: 'keep-alive',
40 silly registry.get     'x-served-by': 'cache-dfw1835-DFW',
40 silly registry.get     'x-cache': 'MISS',
40 silly registry.get     'x-cache-hits': '0',
40 silly registry.get     'x-timer': 'S1442768221.118603,VS0,VE64' } ]
41 silly addNameRange number 2 { name: '&&', range: '*', hasData: true }
42 silly addNameRange versions [ undefined, [] ]
43 error TypeError: Cannot read property 'latest' of undefined
43 error     at next (/usr/share/npm/lib/cache.js:687:35)
43 error     at /usr/share/npm/lib/cache.js:675:5
43 error     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
43 error     at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
43 error     at Object.oncomplete (fs.js:107:15)
44 error If you need help, you may report this log at:
44 error     <http://github.com/isaacs/npm/issues>
44 error or email it to:
44 error     <npm-@googlegroups.com>
45 error System Linux 4.1.0-x86_64-linode59
46 error command "/usr/bin/nodejs" "/usr/bin/npm" "install" "&&" "gulp" "--production"

OMG. I just realized. That %26 are ampersands. It’s not reading my npm install && gulp --production correctly. My bad, been messing with this stuff too long. :slight_smile: