Chris Bolton Chris Bolton - 4 months ago 47
Node.js Question

npm install receiving type error when using docker

I have pulled down the latest ubuntu docker image and I have installed node, npm, etc on the image. I am trying to do an

npm install
on my project. I keep receiving 3 errors like this. I will only show the first time it appears.

path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^

TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/pngquant-bin/v0.3.5/vendor/linux/x64/pngquant',
name: 'pngquant',
os: 'linux',
arch: 'x64' }
at assertPath (path.js:7:11)
at Object.basename (path.js:1357:5)
at /MyProject/WebContent/node_modules/download/index.js:35:43
at each (/MyProject/WebContent/node_modules/download/node_modules/each-async/each-async.js:63:4)
at module.exports (/MyProject/WebContent/node_modules/download/index.js:33:5)
at /MyProject/WebContent/node_modules/bin-wrapper/index.js:108:20
at /MyProject/WebContent/node_modules/bin-wrapper/index.js:141:24
at /MyProject/WebContent/node_modules/bin-check/index.js:30:20
at /MyProject/WebContent/node_modules/executable/index.js:39:20
at FSReqWrap.oncomplete (fs.js:117:15)


So when I go to do a
gulp build
after my
npm install
the
gulp build
will fail. However,
npm install
"succeeds" even though I am getting these type errors.

One thing that is worth noting, I did add this config to my docker image:
git config --global url."https://".insteadOf git://


A couple of more notes:


  1. This works on my local machine mac or windows.

  2. node -v v6.2.2
    npm -v 3.9.5


Answer

Path must be a string.

This is an issue with Node 6.

Downgraded to Node 4 and npm 2 and then npm install and gulp build will work.