gulpjs / liftoff

Launch your command line tool with ease.
MIT License
843 stars 52 forks source link

running when no file found errors #82

Closed yocontra closed 8 years ago

yocontra commented 8 years ago
$ gulp wot

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

TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.basename (path.js:1357:5)
    at Liftoff.buildEnvironment (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:113:52)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:181:32)
    at module.exports (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:174:9)
    at /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:148:9
    at /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/v8flags/index.js:13:7
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

gulp-cli 3.2.2 and liftoff 2.3.0

phated commented 8 years ago

there is no gulp-cli 3.2.2

tkellen commented 8 years ago

Can you give us the output of npm ls in that project @contra?

yocontra commented 8 years ago

Typo - 1.2.2

npm ls for global (fresh install)

/Users/contra/.nvm/versions/node/v6.7.0/lib
└─┬ gulp-cli@1.2.2
  ├── archy@1.0.0
  ├─┬ chalk@1.1.3
  │ ├── ansi-styles@2.2.1
  │ ├── escape-string-regexp@1.0.5
  │ ├─┬ has-ansi@2.0.0
  │ │ └── ansi-regex@2.0.0
  │ ├── strip-ansi@3.0.1
  │ └── supports-color@2.0.0
  ├─┬ fancy-log@1.2.0
  │ └── time-stamp@1.0.1
  ├─┬ gulplog@1.0.0
  │ └─┬ glogg@1.0.0
  │   └── sparkles@1.0.0
  ├── interpret@1.0.1
  ├─┬ liftoff@2.3.0
  │ ├── extend@3.0.0
  │ ├─┬ findup-sync@0.4.2
  │ │ ├─┬ detect-file@0.1.0
  │ │ │ └── fs-exists-sync@0.1.0
  │ │ ├── is-glob@2.0.1
  │ │ └─┬ resolve-dir@0.1.1
  │ │   └─┬ global-modules@0.2.3
  │ │     ├─┬ global-prefix@0.1.4
  │ │     │ ├── ini@1.3.4
  │ │     │ ├─┬ osenv@0.1.3
  │ │     │ │ └── os-tmpdir@1.0.2
  │ │     │ └─┬ which@1.2.11
  │ │     │   └── isexe@1.1.2
  │ │     └── is-windows@0.2.0
  │ ├─┬ fined@1.0.1
  │ │ ├── expand-tilde@1.2.2
  │ │ ├── lodash.assignwith@4.2.0
  │ │ ├── lodash.isarray@4.0.0
  │ │ ├── lodash.isempty@4.4.0
  │ │ ├── lodash.pick@4.4.0
  │ │ └─┬ parse-filepath@1.0.1
  │ │   ├─┬ is-absolute@0.2.5
  │ │   │ ├─┬ is-relative@0.2.1
  │ │   │ │ └─┬ is-unc-path@0.1.1
  │ │   │ │   └── unc-path-regex@0.1.2
  │ │   │ └── is-windows@0.1.1
  │ │   ├── map-cache@0.2.2
  │ │   └─┬ path-root@0.1.1
  │ │     └── path-root-regex@0.1.2
  │ ├── flagged-respawn@0.3.2
  │ ├── lodash.mapvalues@4.6.0
  │ ├── rechoir@0.6.2
  │ └── resolve@1.1.7
  ├── lodash.isfunction@3.0.8
  ├── lodash.isplainobject@4.0.6
  ├── lodash.isstring@4.0.1
  ├── lodash.sortby@4.7.0
  ├─┬ matchdep@1.0.1
  │ ├─┬ findup-sync@0.3.0
  │ │ └─┬ glob@5.0.15
  │ │   ├─┬ inflight@1.0.5
  │ │   │ └── wrappy@1.0.2
  │ │   ├── inherits@2.0.3
  │ │   ├─┬ minimatch@3.0.3
  │ │   │ └─┬ brace-expansion@1.1.6
  │ │   │   ├── balanced-match@0.4.2
  │ │   │   └── concat-map@0.0.1
  │ │   ├── once@1.4.0
  │ │   └── path-is-absolute@1.0.1
  │ ├─┬ micromatch@2.3.11
  │ │ ├─┬ arr-diff@2.0.0
  │ │ │ └── arr-flatten@1.0.1
  │ │ ├── array-unique@0.2.1
  │ │ ├─┬ braces@1.8.5
  │ │ │ ├─┬ expand-range@1.8.2
  │ │ │ │ └─┬ fill-range@2.2.3
  │ │ │ │   ├── is-number@2.1.0
  │ │ │ │   ├─┬ isobject@2.1.0
  │ │ │ │   │ └── isarray@1.0.0
  │ │ │ │   ├── randomatic@1.1.5
  │ │ │ │   └── repeat-string@1.5.4
  │ │ │ ├── preserve@0.2.0
  │ │ │ └── repeat-element@1.1.2
  │ │ ├─┬ expand-brackets@0.1.5
  │ │ │ └── is-posix-bracket@0.1.1
  │ │ ├── extglob@0.3.2
  │ │ ├── filename-regex@2.0.0
  │ │ ├── is-extglob@1.0.0
  │ │ ├─┬ kind-of@3.0.4
  │ │ │ └── is-buffer@1.1.4
  │ │ ├── normalize-path@2.0.1
  │ │ ├─┬ object.omit@2.0.0
  │ │ │ ├─┬ for-own@0.1.4
  │ │ │ │ └── for-in@0.1.6
  │ │ │ └── is-extendable@0.1.1
  │ │ ├─┬ parse-glob@3.0.4
  │ │ │ ├─┬ glob-base@0.3.0
  │ │ │ │ └── glob-parent@2.0.0
  │ │ │ └── is-dotfile@1.0.2
  │ │ └─┬ regex-cache@0.4.3
  │ │   ├── is-equal-shallow@0.1.3
  │ │   └── is-primitive@2.0.0
  │ └── stack-trace@0.0.9
  ├── mute-stdout@1.0.0
  ├── pretty-hrtime@1.0.2
  ├─┬ semver-greatest-satisfied-range@1.0.0
  │ ├── semver@4.3.6
  │ └── semver-regex@1.0.0
  ├─┬ tildify@1.2.0
  │ └── os-homedir@1.0.2
  ├─┬ v8flags@2.0.11
  │ └── user-home@1.1.1
  ├─┬ wreck@6.3.0
  │ ├── boom@2.10.1
  │ └── hoek@2.16.3
  └─┬ yargs@3.32.0
    ├── camelcase@2.1.1
    ├─┬ cliui@3.2.0
    │ └── wrap-ansi@2.0.0
    ├── decamelize@1.2.0
    ├─┬ os-locale@1.4.0
    │ └─┬ lcid@1.0.0
    │   └── invert-kv@1.0.0
    ├─┬ string-width@1.0.2
    │ ├─┬ code-point-at@1.0.1
    │ │ └── number-is-nan@1.0.1
    │ └── is-fullwidth-code-point@1.0.0
    ├── window-size@0.1.4
    └── y18n@3.2.1

Error happens when you run gulp in a folder with nothing in it (cd ~ && gulp to reproduce)

sttk commented 8 years ago

The current liftoff code doesn't use path.basename but it was used before #49. (That line number also matches.) Though there may be cases that configPath becames null, the current liftoff and gulp-cli checks if the configPath is null.

I tried to reproduce this but did not. What I did was:

$ sudo npm install -g gulp-cli
$ cd /tmp/test
$ gulp -v
[12:09:22] CLI version 1.2.2
$ gulp
[12:09:24] Local gulp not found in /private/tmp/test
[12:09:24] Try running: npm install gulp
$ npm install gulp
$ gulp -v
[12:11:25] CLI version 1.2.2
[12:11:25] Local version 3.9.1
$ gulp
[12:11:40] No gulpfile found
$ npm install gulpjs/gulp#4.0
$ gulp -v
[12:13:10] CLI version 1.2.2
[12:13:10] Local version 4.0.0-alpha.2
$ gulp
[12:13:29] No gulpfile found
$
yocontra commented 8 years ago

Fresh install still having issues:

$ npm install gulp-cli -g
/Users/contra/.nvm/versions/node/v6.7.0/bin/gulp -> /Users/contra/.nvm/versions/node/v6.7.0/lib/node_modules/gulp-cli/bin/gulp.js
/Users/contra/.nvm/versions/node/v6.7.0/lib
└─┬ gulp-cli@1.2.2
  ├── archy@1.0.0
  ├─┬ chalk@1.1.3
  │ ├── ansi-styles@2.2.1
  │ ├── escape-string-regexp@1.0.5
  │ ├─┬ has-ansi@2.0.0
  │ │ └── ansi-regex@2.0.0
  │ ├── strip-ansi@3.0.1
  │ └── supports-color@2.0.0
  ├─┬ fancy-log@1.2.0
  │ └── time-stamp@1.0.1
  ├─┬ gulplog@1.0.0
  │ └─┬ glogg@1.0.0
  │   └── sparkles@1.0.0
  ├── interpret@1.0.1
  ├─┬ liftoff@2.3.0
  │ ├── extend@3.0.0
  │ ├─┬ findup-sync@0.4.2
  │ │ ├─┬ detect-file@0.1.0
  │ │ │ └── fs-exists-sync@0.1.0
  │ │ ├── is-glob@2.0.1
  │ │ └─┬ resolve-dir@0.1.1
  │ │   └─┬ global-modules@0.2.3
  │ │     ├─┬ global-prefix@0.1.4
  │ │     │ ├── ini@1.3.4
  │ │     │ ├─┬ osenv@0.1.3
  │ │     │ │ └── os-tmpdir@1.0.2
  │ │     │ └─┬ which@1.2.11
  │ │     │   └── isexe@1.1.2
  │ │     └── is-windows@0.2.0
  │ ├─┬ fined@1.0.2
  │ │ ├── expand-tilde@1.2.2
  │ │ ├── lodash.assignwith@4.2.0
  │ │ ├── lodash.isempty@4.4.0
  │ │ ├── lodash.pick@4.4.0
  │ │ └─┬ parse-filepath@1.0.1
  │ │   ├─┬ is-absolute@0.2.5
  │ │   │ ├─┬ is-relative@0.2.1
  │ │   │ │ └─┬ is-unc-path@0.1.1
  │ │   │ │   └── unc-path-regex@0.1.2
  │ │   │ └── is-windows@0.1.1
  │ │   ├── map-cache@0.2.2
  │ │   └─┬ path-root@0.1.1
  │ │     └── path-root-regex@0.1.2
  │ ├── flagged-respawn@0.3.2
  │ ├── lodash.mapvalues@4.6.0
  │ ├── rechoir@0.6.2
  │ └── resolve@1.1.7
  ├── lodash.isfunction@3.0.8
  ├── lodash.isplainobject@4.0.6
  ├── lodash.isstring@4.0.1
  ├── lodash.sortby@4.7.0
  ├─┬ matchdep@1.0.1
  │ ├─┬ findup-sync@0.3.0
  │ │ └─┬ glob@5.0.15
  │ │   ├─┬ inflight@1.0.5
  │ │   │ └── wrappy@1.0.2
  │ │   ├── inherits@2.0.3
  │ │   ├─┬ minimatch@3.0.3
  │ │   │ └─┬ brace-expansion@1.1.6
  │ │   │   ├── balanced-match@0.4.2
  │ │   │   └── concat-map@0.0.1
  │ │   ├── once@1.4.0
  │ │   └── path-is-absolute@1.0.1
  │ ├─┬ micromatch@2.3.11
  │ │ ├─┬ arr-diff@2.0.0
  │ │ │ └── arr-flatten@1.0.1
  │ │ ├── array-unique@0.2.1
  │ │ ├─┬ braces@1.8.5
  │ │ │ ├─┬ expand-range@1.8.2
  │ │ │ │ └─┬ fill-range@2.2.3
  │ │ │ │   ├── is-number@2.1.0
  │ │ │ │   ├─┬ isobject@2.1.0
  │ │ │ │   │ └── isarray@1.0.0
  │ │ │ │   ├── randomatic@1.1.5
  │ │ │ │   └── repeat-string@1.5.4
  │ │ │ ├── preserve@0.2.0
  │ │ │ └── repeat-element@1.1.2
  │ │ ├─┬ expand-brackets@0.1.5
  │ │ │ └── is-posix-bracket@0.1.1
  │ │ ├── extglob@0.3.2
  │ │ ├── filename-regex@2.0.0
  │ │ ├── is-extglob@1.0.0
  │ │ ├─┬ kind-of@3.0.4
  │ │ │ └── is-buffer@1.1.4
  │ │ ├── normalize-path@2.0.1
  │ │ ├─┬ object.omit@2.0.0
  │ │ │ ├─┬ for-own@0.1.4
  │ │ │ │ └── for-in@0.1.6
  │ │ │ └── is-extendable@0.1.1
  │ │ ├─┬ parse-glob@3.0.4
  │ │ │ ├─┬ glob-base@0.3.0
  │ │ │ │ └── glob-parent@2.0.0
  │ │ │ └── is-dotfile@1.0.2
  │ │ └─┬ regex-cache@0.4.3
  │ │   ├── is-equal-shallow@0.1.3
  │ │   └── is-primitive@2.0.0
  │ └── stack-trace@0.0.9
  ├── mute-stdout@1.0.0
  ├── pretty-hrtime@1.0.2
  ├─┬ semver-greatest-satisfied-range@1.0.0
  │ ├── semver@4.3.6
  │ └── semver-regex@1.0.0
  ├─┬ tildify@1.2.0
  │ └── os-homedir@1.0.2
  ├─┬ v8flags@2.0.11
  │ └── user-home@1.1.1
  ├─┬ wreck@6.3.0
  │ ├── boom@2.10.1
  │ └── hoek@2.16.3
  └─┬ yargs@3.32.0
    ├── camelcase@2.1.1
    ├─┬ cliui@3.2.0
    │ └── wrap-ansi@2.0.0
    ├── decamelize@1.2.0
    ├─┬ os-locale@1.4.0
    │ └─┬ lcid@1.0.0
    │   └── invert-kv@1.0.0
    ├─┬ string-width@1.0.2
    │ ├─┬ code-point-at@1.0.1
    │ │ └── number-is-nan@1.0.1
    │ └── is-fullwidth-code-point@1.0.0
    ├── window-size@0.1.4
    └── y18n@3.2.1

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

TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.basename (path.js:1357:5)
    at Liftoff.buildEnvironment (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:113:52)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:181:32)
    at module.exports (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:174:9)
    at /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:148:9
    at /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/v8flags/index.js:13:7
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
sttk commented 8 years ago

In the error stack traces :

... at /usr/local/lib/node_modules/gulp/node_modules/gulp-cli/node_modules/liftoff/index.js:148:9 ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Is old gulp-cli in global installed gulp used?

yocontra commented 8 years ago

If nobody else is able to repro I guess I'll wipe my computer and close this, probably something fucked up with npm pointing to old versions.

phated commented 7 years ago

@contra just getting a chance to look at this with the new details. It looks like your global has gulp installed instead of gulp-cli. Not sure if that might be causing the problem. The main gulp package can be removed from global.

yocontra commented 7 years ago

@phated yep, was an npm fuckup somehow. even with a fresh npm rm gulp; npm cache rm; npm install gulp-cli it was still an issue