Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version undefined after npm install #1088

Closed
albertjan opened this issue Jun 3, 2015 · 15 comments
Closed

version undefined after npm install #1088

albertjan opened this issue Jun 3, 2015 · 15 comments

Comments

@albertjan
Copy link

Also reported over at @projectkudu projectkudu/kudu#1573

The first time after we do npm install we see this error:

\home\site\repository\node_modules\gulp\node_modules\semver\semver.js:281
    throw new TypeError('Invalid Version: ' + version);
          ^
TypeError: Invalid Version: undefined
    at new SemVer (D:\home\site\repository\node_modules\gulp\node_modules\semver\semver.js:281:11)
    at SemVer.compare (D:\home\site\repository\node_modules\gulp\node_modules\semver\semver.js:348:13)
    at compare (D:\home\site\repository\node_modules\gulp\node_modules\semver\semver.js:571:31)
    at Function.gt (D:\home\site\repository\node_modules\gulp\node_modules\semver\semver.js:600:10)
    at Liftoff.handleArguments (D:\home\site\repository\node_modules\gulp\bin\gulp.js:99:14)
    at Liftoff.<anonymous> (D:\home\site\repository\node_modules\gulp\node_modules\liftoff\index.js:192:16)
    at module.exports (D:\home\site\repository\node_modules\gulp\node_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
    at Liftoff.<anonymous> (D:\home\site\repository\node_modules\gulp\node_modules\liftoff\index.js:185:9)
    at D:\home\site\repository\node_modules\gulp\node_modules\liftoff\index.js:159:9
    at D:\home\site\repository\node_modules\gulp\node_modules\v8flags\index.js:79:12

If we run gulp --version before gulp it works.

@phated
Copy link
Member

phated commented Jun 3, 2015

Looks to be related to an old version gulp.

@albertjan
Copy link
Author

No I installed gulp 3.9.0 locally and ran node node_modules\gulp\bin\gulp.js and got the same result.

Sent from my iPhone

On 3 jun. 2015, at 21:29, Blaine Bublitz notifications@github.com wrote:

Looks to be related to an old version gulp.


Reply to this email directly or view it on GitHub.

@phated
Copy link
Member

phated commented Jun 3, 2015

why are you running the bin with node? Only executing the bin is supported

@phated phated closed this as completed Jun 3, 2015
@albertjan
Copy link
Author

Why did you close the issue. Even if i edit the path on my azure machine and run gulp.cmd from appdata npm packages i have the same issue.

Sent from my iPhone

On 3 jun. 2015, at 21:43, Blaine Bublitz notifications@github.com wrote:

why are you running the bin with node? Only executing the bin is supported


Reply to this email directly or view it on GitHub.

@tkellen
Copy link

tkellen commented Jun 3, 2015

I'm not able to reproduce this. Can you paste the output of this please?

node -v
npm -v
mkdir test
cd test
npm install gulp
touch gulpfile.js
node node_modules/gulp/bin/gulp

@albertjan
Copy link
Author

Will do tomorrow morning. :)

Sent from my iPhone

On 3 jun. 2015, at 22:26, Tyler Kellen notifications@github.com wrote:

I'm not able to reproduce this. Can you paste the output of this please?

node -v
npm -v
mkdir test
cd test
npm install gulp
touch gulpfile.js
node node_modules/gulp/bin/gulp

Reply to this email directly or view it on GitHub.

@albertjan
Copy link
Author

Yeah it became the afternoon 😄 here we go:

PS D:\home\> mkdir gulp-test


    Directory: D:\home


Mode                LastWriteTime     Length Name                              
----                -------------     ------ ----                              
d----          6/4/2015   1:09 PM            gulp-test                         


PS D:\home> cd gulp-test
PS D:\home\gulp-test> node -v
v0.12.2
PS D:\home\gulp-test> npm -v
2.7.4
PS D:\home\gulp-test> npm install gulp
gulp@3.9.0 node_modules\gulp
├── pretty-hrtime@1.0.0
├── interpret@0.6.2
├── deprecated@0.0.1
├── archy@1.0.0
├── tildify@1.0.0 (user-home@1.1.1)
├── v8flags@2.0.5 (user-home@1.1.1)
├── minimist@1.1.1
├── chalk@1.0.0 (escape-string-regexp@1.0.3, ansi-styles@2.0.1, supports-color@1.3.1, strip-ansi@2.0.1, has-ansi@1.0.3)
├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── semver@4.3.6
├── gulp-util@3.0.5 (array-differ@1.0.0, array-uniq@1.0.2, lodash._reevaluate@3.0.0, beeper@1.1.0, lodash._reescape@3.0.0, lodash._reinterpolate@3.0.0, object-assign@2.1.0, replace-ext@0.0.1, vinyl@0.4.6, lodash.template@3.6.1, through2@0.6.5, multipipe@0.1.2, dateformat@1.0.11)
├── liftoff@2.1.0 (extend@2.0.1, rechoir@0.6.1, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.2.1)
└── vinyl-fs@0.3.13 (graceful-fs@3.0.8, strip-bom@1.0.0, defaults@1.0.2, vinyl@0.4.6, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
PS D:\home\gulp-test> echo $null >> gulpfile.js
PS D:\home\gulp-test> node .\node_modules\gulp\bin\gulp
D:\home\gulp-test\node_modules\gulp\node_modules\semver\semver.js:281
    throw new TypeError('Invalid Version: ' + version);
          ^
TypeError: Invalid Version: undefined
    at new SemVer (D:\home\gulp-test\node_modules\gulp\node_modules\semver\semver.js:281:11)
    at SemVer.compare (D:\home\gulp-test\node_modules\gulp\node_modules\semver\semver.js:348:13)
    at compare (D:\home\gulp-test\node_modules\gulp\node_modules\semver\semver.js:571:31)
    at Function.gt (D:\home\gulp-test\node_modules\gulp\node_modules\semver\semver.js:600:10)
    at Liftoff.handleArguments (D:\home\gulp-test\node_modules\gulp\bin\gulp.js:99:14)
    at Liftoff.<anonymous> (D:\home\gulp-test\node_modules\gulp\node_modules\liftoff\index.js:192:16)
    at module.exports (D:\home\gulp-test\node_modules\gulp\node_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
    at Liftoff.<anonymous> (D:\home\gulp-test\node_modules\gulp\node_modules\liftoff\index.js:185:9)
    at D:\home\gulp-test\node_modules\gulp\node_modules\liftoff\index.js:159:9
    at D:\home\gulp-test\node_modules\gulp\node_modules\v8flags\index.js:79:12
PS D:\home\gulp-test>  

@albertjan
Copy link
Author

Then when I run this:

PS D:\home\gulp-test> node .\node_modules\gulp\bin\gulp -v
[13:15:10] CLI version 3.9.0
[13:15:10] Local version 3.9.0
PS D:\home\gulp-test> node .\node_modules\gulp\bin\gulp
[13:15:31] Using gulpfile D:\home\gulp-test\gulpfile.js
[13:15:33] Task 'default' is not in your gulpfile
[13:15:33] Please check the documentation for proper gulpfile formatting

gulp magically fixes it self 😄

@tkellen
Copy link

tkellen commented Jun 4, 2015

Still unable to reproduce this.

C:\Users\Test> node -v
v0.12.4
C:\Users\Test> npm -v
2.10.1
C:\Users\Test> cd blah
C:\Users\Test\blah> npm install gulp
gulp@3.9.0 node_modules\gulp
├── pretty-hrtime@1.0.0
├── interpret@0.6.2
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.1.1
├── tildify@1.0.0 (user-home@1.1.1)
├── v8flags@2.0.5 (user-home@1.1.1)
├── semver@4.3.6
├── chalk@1.0.0 (escape-string-regexp@1.0.3, ansi-styles@2.0.1, supports-color@1
.3.1, strip-ansi@2.0.1, has-ansi@1.0.3)
├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.
1.5)
├── gulp-util@3.0.5 (array-differ@1.0.0, object-assign@2.0.0, array-uniq@1.0.2,
beeper@1.1.0, lodash._reevaluate@3.0.0, lodash._reescape@3.0.0, lodash._reinterp
olate@3.0.0, replace-ext@0.0.1, vinyl@0.4.6, lodash.template@3.6.1, through2@0.6
.5, multipipe@0.1.2, dateformat@1.0.11)
├── liftoff@2.1.0 (extend@2.0.1, rechoir@0.6.1, flagged-respawn@0.3.1, resolve@1
.1.6, findup-sync@0.2.1)
└── vinyl-fs@0.3.13 (graceful-fs@3.0.8, strip-bom@1.0.0, defaults@1.0.2, vinyl@0
.4.6, mkdirp@0.5.1, glob-stream@3.1.18, through2@0.6.5, glob-watcher@0.0.6)
C:\Users\Test\blah> echo $null >> gulpfile.js
C:\Users\Test\blah> node .\node_modules\gulp\bin\gulp.js
[16:21:45] Using gulpfile ~\blah\gulpfile.js
[16:21:45] Task 'default' is not in your gulpfile
[16:21:45] Please check the documentation for proper gulpfile formatting
C:\Users\Test\blah>

What shell are you using? I'm using PowerShell above.

@albertjan
Copy link
Author

Using powershell as well

PS D:\home> echo $PSVersionTable

Name                           Value                                           
----                           -----                                           
PSVersion                      3.0                                             
WSManStackVersion              3.0                                             
SerializationVersion           1.1.0.1                                         
CLRVersion                     4.0.30319.36213                                 
BuildVersion                   6.2.9200.17065                                  
PSCompatibleVersions           {1.0, 2.0, 3.0}                                 
PSRemotingProtocolVersion      2.2     

@albertjan
Copy link
Author

It's apparently not a very wide spread issue. And I've found a work around. @tkellen thanks for looking into it! On another machine where the only difference is the powershell version it also works.

@roddharris
Copy link

@albertjan what was your work around? I'm having the same issue (except this is on my local machine and not Azure). I have to run gulp -v each time before I run gulp in order for it to work.

@albertjan
Copy link
Author

@roddharris that was my work around. 😄

@jaden
Copy link

jaden commented Jul 17, 2015

I was getting the same error, but due to a slightly different problem. I had gulp installed globally but not locally. That doesn't seem to be @albertjan's issue, but in case anyone else is running into this issue or if it sheds some light on the other issue, here's what I was seeing.

With gulp installed globally, running gulp when it's not installed in node_modules consistently produces the error. Running npm install gulp resolves the issue.

To illustrate:

PS D:\dev> node -v
v0.12.7
PS D:\dev> npm -v
2.11.3
PS D:\dev> gulp -v
[23:10:27] CLI version 3.9.0
PS D:\dev> mkdir test


    Directory: D:\dev


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----     7/16/2015 Thu     23:10            test


PS D:\dev> cd test
PS D:\dev\test> touch gulpfile.js
PS D:\dev\test> gulp
D:\Dev\nodejs\node_modules\gulp\node_modules\semver\semver.js:281
    throw new TypeError('Invalid Version: ' + version);
          ^
TypeError: Invalid Version: undefined
    at new SemVer (D:\Dev\nodejs\node_modules\gulp\node_modules\semver\semver.js:281:11)
    at SemVer.compare (D:\Dev\nodejs\node_modules\gulp\node_modules\semver\semver.js:348:13)
    at compare (D:\Dev\nodejs\node_modules\gulp\node_modules\semver\semver.js:571:31)
    at Function.gt (D:\Dev\nodejs\node_modules\gulp\node_modules\semver\semver.js:600:10)
    at Liftoff.handleArguments (D:\Dev\nodejs\node_modules\gulp\bin\gulp.js:99:14)
    at Liftoff.<anonymous> (D:\Dev\nodejs\node_modules\gulp\node_modules\liftoff\index.js:192:16)
    at module.exports (D:\Dev\nodejs\node_modules\gulp\node_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
    at Liftoff.<anonymous> (D:\Dev\nodejs\node_modules\gulp\node_modules\liftoff\index.js:185:9)
    at D:\Dev\nodejs\node_modules\gulp\node_modules\liftoff\index.js:159:9
    at D:\Dev\nodejs\node_modules\gulp\node_modules\v8flags\index.js:91:14

And the fix:

PS D:\dev\test> npm install gulp
gulp@3.9.0 node_modules\gulp
├── pretty-hrtime@1.0.0
├── interpret@0.6.4
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.1.1
├── tildify@1.1.0 (os-homedir@1.0.0)
├── v8flags@2.0.9 (user-home@1.1.1)
├── semver@4.3.6
├── chalk@1.1.0 (escape-string-regexp@1.0.3, ansi-styles@2.1.0, supports-color@2.0.0, has-ansi@2.0.0, strip-ansi@3.0.0)
├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── liftoff@2.1.0 (extend@2.0.1, rechoir@0.6.1, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.2.1)
├── vinyl-fs@0.3.13 (graceful-fs@3.0.8, defaults@1.0.2, strip-bom@1.0.0, vinyl@0.4.6, mkdirp@0.5.1, through2@0.6.5, glob
-stream@3.1.18, glob-watcher@0.0.6)
└── gulp-util@3.0.6 (array-differ@1.0.0, array-uniq@1.0.2, beeper@1.1.0, lodash._reevaluate@3.0.0, lodash._reinterpolate
@3.0.0, lodash._reescape@3.0.0, object-assign@3.0.0, replace-ext@0.0.1, vinyl@0.5.0, lodash.template@3.6.2, through2@2.0
.0, multipipe@0.1.2, dateformat@1.0.11)
PS D:\dev\test> gulp
[23:11:39] Using gulpfile D:\dev\test\gulpfile.js
[23:11:40] Task 'default' is not in your gulpfile
[23:11:40] Please check the documentation for proper gulpfile formatting

@ghost
Copy link

ghost commented Sep 4, 2015

I can't seem to resolve this issue and have tried all of these work arounds.
running node .\node_modules\gulp\gin\gulp -v only returns
[11:15:49] CLI version 3.9.0

then I try to npm install gulp or npm install --save-dev gulp and still get
C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_modules\semver\semver
.js:281
throw new TypeError('Invalid Version: ' + version);
^
TypeError: Invalid Version: undefined
at new SemVer (C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_mo
dules\semver\semver.js:281:11)
at SemVer.compare (C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\nod
e_modules\semver\semver.js:348:13)
at compare (C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_modul
es\semver\semver.js:571:31)
at Function.gt (C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_m
odules\semver\semver.js:600:10)
at Liftoff.handleArguments (C:\Users\137124\AppData\Roaming\npm\node_modules
\gulp\bin\gulp.js:99:14)
at Liftoff. (C:\Users\137124\AppData\Roaming\npm\node_modules\gul
p\node_modules\liftoff\index.js:192:16)
at module.exports (C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\nod
e_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
at Liftoff. (C:\Users\137124\AppData\Roaming\npm\node_modules\gul
p\node_modules\liftoff\index.js:185:9)
at C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_modules\liftof
f\index.js:159:9
at C:\Users\137124\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flag
s\index.js:99:14

help!

@gulpjs gulpjs locked and limited conversation to collaborators Sep 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants