Chris Bolton Chris Bolton - 1 year ago 184
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.

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

TypeError: Path must be a string. Received { url: '',
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
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download