google / web-starter-kit

Web Starter Kit - a workflow for multi-device websites
http://developers.google.com/web/starter-kit
Apache License 2.0
18.42k stars 3.01k forks source link

npm install fails on Debian/Ubuntu #323

Closed MattWilcox closed 10 years ago

MattWilcox commented 10 years ago

After installing the pre-requisites the npm install command produces a number of errors on Debian/Ubuntu systems. This seems to be because the project is assuming 'node' as the application name when in Debian/Ubuntu it is 'nodejs'. I'm new to npm etc so I don't know if this is a problem with the web-starter-kit or something else. Here's sample output from the command line:

> phantomjs@1.9.7-15 install /home/matt/Sites/starterkit/web-starter-kit/node_modules/gulp-uncss/node_modules/uncss/node_modules/phantomjs
> node install.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm http GET https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/ncp
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/jsonfile
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/base64-js
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/ncp
npm http GET https://registry.npmjs.org/ncp/-/ncp-0.5.1.tgz
npm http 200 https://registry.npmjs.org/base64-js
npm http 304 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/base64-js/-/base64-js-0.0.7.tgz
npm http 304 https://registry.npmjs.org/jsonfile
npm http 304 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/jsonfile/-/jsonfile-1.2.0.tgz
npm http 200 https://registry.npmjs.org/ncp/-/ncp-0.5.1.tgz
npm http 200 https://registry.npmjs.org/base64-js/-/base64-js-0.0.7.tgz
npm http 200 https://registry.npmjs.org/jsonfile/-/jsonfile-1.2.0.tgz
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/amdefine

> optipng-bin@0.3.9 postinstall /home/matt/Sites/starterkit/web-starter-kit/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin
> node index.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN optional dep failed, continuing imagemin-optipng@0.1.0

> jpegtran-bin@0.2.7 postinstall /home/matt/Sites/starterkit/web-starter-kit/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/jpegtran-bin
> node index.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN optional dep failed, continuing imagemin-jpegtran@0.1.0
npm http GET https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/inherits

> gifsicle@0.1.6 postinstall /home/matt/Sites/starterkit/web-starter-kit/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node index.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN optional dep failed, continuing imagemin-gifsicle@0.1.1

> pngquant-bin@0.3.1 postinstall /home/matt/Sites/starterkit/web-starter-kit/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-pngquant/node_modules/pngquant-bin
> node index.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN optional dep failed, continuing imagemin-pngquant@0.1.2
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/matt/Sites/starterkit/web-starter-kit/npm-debug.log
npm ERR! not ok code 0
addyosmani commented 10 years ago

I believe http://stackoverflow.com/questions/21168141/can-not-install-packages-using-node-package-manager-in-ubuntu is related to your issue. In short, try sudo apt-get install nodejs-legacy.

passy commented 10 years ago

Yes, the second answer is right. Some install scripts expect there a binary called node to be present whereby Ubuntu installs it as nodejs. A symlink will take care of that.

MattWilcox commented 10 years ago

Thanks both. Was asked on Twitter to create an Issue so this could be addressed, that's solved my problem!

I wonder if there might be a tidier way of dealing with Debian/Ubuntu users to either make them aware of this without raising an issue or getting it done automatically? :)