Skip to content
This repository was archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #258 from Financial-Times/install-help
Browse files Browse the repository at this point in the history
Improves instructions when obt install fails
  • Loading branch information
Alberto Elias committed May 7, 2015
2 parents ef49fdf + d51bc11 commit 19929b0
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
27 changes: 27 additions & 0 deletions TROUBLESHOOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@ If the error still occurs, run the command manually by prefixing sudo to it. It'
sudo gem install scss-lint -v 0.35.0
```

### Error `npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bower" "--quiet"`

When installing [bower](https://bower.io), depending on how permissions are set on your machine, OBT might fail and return something like this:

>npm ERR! Darwin 14.3.0
>npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bower" "--quiet"
>npm ERR! node v0.12.2
>npm ERR! npm v2.1.6
>npm ERR! path /usr/local/lib/node_modules/bower
>npm ERR! code EACCES
>npm ERR! errno -13
>
>npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/bower'
>npm ERR! at Error (native)
>npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/bower']
>npm ERR! errno: -13,
>npm ERR! code: 'EACCES',
>npm ERR! path: '/usr/local/lib/node_modules/bower' }
>npm ERR!
>npm ERR! Please try running this command again as root/Administrator.
The command can be ran manually prefixing sudo to it. It's the following command (substituting the version number by the one mentioned [here](https://github.com/Financial-Times/origami-build-tools/#install)):

```bash
sudo npm install -g bower@^1.3.1
```

### Warning `Origami registry is not configured in a .bowerrc file`

Origami modules are listed on Origami's custom Bower registry, and aren't available to the global, public one. Custom registries can be added to a `.bowerrc` configuration file located in your home directory. To create a `.bowerrc` configuration file now, run::
Expand Down
1 change: 0 additions & 1 deletion lib/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ module.exports.sass = function(gulp, config) {

return gulp.src(src)
.pipe(sass(sassConfig))
.on('error', function(err) { console.log(err); throw err; })
.pipe(gulpif(useSourceMaps, sourcemaps.init({loadMaps: true})))
.pipe(autoprefixer(autoprefixerConfig))
.pipe(gulpif(config.env === 'production', cleanCss(config.cleanCss || {
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function buildHtml(gulp, demoConfig, staticSource) {
var destName = demoConfig.name + '.html';
var data = {};
if (!fs.existsSync(src)) {
throw new Error("Demo template not found: " + src);
throw new Error('Demo template not found: ' + src);
}
if (typeof demoConfig.data === 'string') {
var dataPath = path.join(process.cwd(), '/' + demoConfig.data);
Expand Down
10 changes: 6 additions & 4 deletions lib/tasks/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ function cliSuccess(output) {
log.primary('Install successful.');
}

function cliFailed(output) {
function cliFailed(output, command) {
log.primaryError('Task failed');
log.primaryError(output.stderr);
log.primaryError('On some systems, OBT\'s dependencies require sudo to install. Please run the following command and then retry your install');
log.primary('sudo ' + command);
process.exit(1);
}

Expand Down Expand Up @@ -129,7 +131,7 @@ module.exports.installScssLint = function() {
cliSuccess();
}, function(output) {
outputInstalling();
cliFailed(output);
cliFailed(output, 'gem install scss-lint -v ' + bestGems.scssLint);
});
} else {
log.secondary('scss-lint gem ' + version + ' already installed.');
Expand All @@ -148,14 +150,14 @@ module.exports.installBower = function() {
getInstalledBowerVersion()
.then(function(version) {
if (version === -1 || !semver.satisfies(version, versions.bower)) {
commandLine.run('npm', ['install', '-g', 'bower', '--quiet'])
commandLine.run('npm', ['install', '-g', 'bower@' + versions.bower, '--quiet'])
.then(function() {
outputInstalling();
cliSuccess();
resolve();
}, function(output) {
outputInstalling();
cliFailed(output);
cliFailed(output, 'npm install -g bower@' + versions.bower);
reject();
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/watch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var log = require('../helpers/log');
var watchGlobs = [
Expand All @@ -21,7 +21,7 @@ var watchGlobs = [

module.exports = {
run: function(task, gulp, config) {
if (typeof task !== "function") {
if (typeof task !== 'function') {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"gulp-minify-css": "^1.0.0",
"gulp-mustache": "^1.0.2",
"gulp-rename": "^1.2.0",
"gulp-sass": "dlmanning/gulp-sass#2.x",
"gulp-sass": "^2.0.0",
"gulp-scss-lint": "^0.1.12",
"gulp-sourcemaps": "^1.5.1",
"gulp-streamify": "0.0.5",
Expand All @@ -43,7 +43,7 @@
"merge-stream": "^0.1.6",
"minimist": "^1.1.1",
"nightwatch": "^0.5.36",
"node-sass": "^3.0.0-beta.7",
"node-sass": "^3.0.0",
"node.extend": "^1.0.9",
"npmconf": "^2.1.1",
"portfinder": "^0.4.0",
Expand Down
6 changes: 2 additions & 4 deletions templates/page.mustache
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!DOCTYPE html>
<!--[if IE 7]> <html class="o-useragent-ie7 o-hoverable-on"> <![endif]-->
<!--[if IE 8]> <html class="o-useragent-ie8 o-hoverable-on"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="o-hoverable-on"> <!--<![endif]-->
<head class="{{oDemoDocumentClasses}}">
<html class="o-hoverable-on {{oDemoDocumentClasses}}">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>{{oDemoTitle}}</title>
Expand Down

0 comments on commit 19929b0

Please sign in to comment.