isaacs / node-glob Goto Github PK
View Code? Open in Web Editor NEWglob functionality for node.js
License: ISC License
glob functionality for node.js
License: ISC License
I get the following error when trying to use glob with node v0.5.4-pre...
Error: /home/tim/local/lib/node_modules/glob/build/default/glob.node: undefined symbol: ev_rt_now
I'm sure this has to do with changes in node itself but a fix for glob would be most appreciated!
Steps to repro:
Note:
Expected result:
Actual result:
PS:
Hi. I think it's useful to have general FileList like utility and it seems to be easy to extend current implementation to handle multiple include-exclude patterns. I am going to do it anyway, but it's much easier to do for creator.
Would be nice to actually include what glob does, since looking for "glob" without knowing "glob" is not that easy (google has no way to direct here) and it's also nice to be assured at the beginning of the Readme what the package does :).
If the pattern is something like dir/*
, matching directories will not have a trailing / with the mark option enabled.
However dir/*/**
marks directories as expected.
When the glob pattern doesn't have any "fancy" characters in it, the nocase
option doesn't appear to work.
The first two examples below behave as expected, but I expect the final example to return [ 'Foo.txt', 'foo.txt' ]
instead of [ 'Foo.txt' ]
.
I tested this in a Mac OS Extended (Case-sensitive, Journaled) partition disk image.
$ npm install glob --silent
[email protected] node_modules/glob
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected])
$ touch Foo.txt foo.txt
$ node -pe 'require("glob").sync("Foo.*")'
[ 'Foo.txt' ]
$ node -pe 'require("glob").sync("Foo.*", {nocase: true})'
[ 'Foo.txt', 'foo.txt' ]
$ node -pe 'require("glob").sync("Foo.txt", {nocase: true})'
[ 'Foo.txt' ]
andreas@ubuntu:~$ npm -v
1.0.106
andreas@ubuntu:~$ node -v
v0.4.13-pre
andreas@ubuntu:~$ node
> require('glob').sync('/');
[]
> require('glob').sync('/*');
[]
> require('glob').sync('/usr/');
[]
> require('glob').sync('/usr/*');
[]
It used to work:
> andreas@ubuntu:~$ npm install [email protected]
[...]
node
> require('glob').sync('/');
[ '/' ]
> require('glob').sync('/*');
[ '/bin/',
'/boot/',
'/cdrom/',
'/dev/',
[...]
'/vmlinuz']
On a fresh ubuntu maverick install, installing node-glob with npm fails:
'clean' finished successfully (0.020s)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /opt/node-0.4.0
'configure' finished successfully (0.060s)
Waf: Entering directory `/opt/node-0.4.0/lib/node/.npm/.cache/glob/2.0.0/package/build'
[1/4] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_1.o
../deps/glob/glob.c:36: warning: extra tokens at end of #ifdef directive
../deps/glob/glob.c:1188: warning: extra tokens at end of #ifdef directive
../deps/glob/glob.c: In function ‘DIR* g_opendir(Char*, glob_t*)’:
../deps/glob/glob.c:1074: error: ‘strlcpy’ was not declared in this scope
Waf: Leaving directory `/opt/node-0.4.0/lib/node/.npm/.cache/glob/2.0.0/package/build'
Build failed: -> task failed (err \#1):
{task: cxx glob.c -> glob_1.o}
strlcpy
is available in libbsd on debian based distros.
To reproduce, generate 129 or more files in an empty directory:
perl -e 'for (1..129) {system "touch $_.dat";}'
And then run this snippet in the node repl:
require('glob').glob('*', function (err, fileNames) {console.log(arguments);});
On Ubuntu 10.10 and glob 2.0.5 this results in:
> { '0':
{ message: 'GLOB_NOSPACE'
, stack: [Getter/Setter]
, errno: -1
}
, '1': '*'
}
From a couple of quick tests I concluded that it's the number of entries in the result that matters, not the number of candidate files.
glob 1.1.0 worked fine with any number of entries I've thrown at it so far.
npm install
says:
> [email protected] preinstall /Users/maciej/Programowanie/Sources/node-glob
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.045s)
Waf: Entering directory `/Users/maciej/Programowanie/Sources/node-glob/build'
[1/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_1.o
[2/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_2.o
[3/8] cxx: src/glob.cc -> build/Release/src/glob_3.o
[4/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_4.o
[5/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_5.o
../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’:
../src/glob.cc:150: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(eio_req*)’
../src/glob.cc:150: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, int (*)(eio_req*), void*)’
Waf: Leaving directory `/Users/maciej/Programowanie/Sources/node-glob/build'
Build failed: -> task failed (err #1):
{task: cxx glob.cc -> glob_3.o}
npm ERR! [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the glob package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls glob
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/maciej/Programowanie/Sources/node-glob
npm ERR! node -v v0.5.9
npm ERR! npm -v 1.0.99
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/maciej/Programowanie/Sources/node-glob/npm-debug.log
npm not ok
I'm seeing this bug in v3.1.14. Given this directory structure:
deep
├── deep.txt
└── deeper
├── deeper.txt
└── deepest
└── deepest.txt
In OS X I get this (which is expected)
$ node -pe "require('glob').sync('d**/**')"
[ 'deep',
'deep/deep.txt',
'deep/deeper',
'deep/deeper/deeper.txt',
'deep/deeper/deepest',
'deep/deeper/deepest/deepest.txt' ]
$ node -pe "require('glob').sync('d**/**/')"
[ 'deep/', 'deep/deeper/', 'deep/deeper/deepest/' ]
But in Windows I get this (this is not expected)
C:\test>node -pe "require('glob').sync('d**/**')"
[ 'deep',
'deep/deep.txt',
'deep/deeper',
'deep/deeper/deeper.txt',
'deep/deeper/deepest',
'deep/deeper/deepest/deepest.txt' ]
C:\test>node -pe "require('glob').sync('d**/**/')"
[ 'deep/',
'deep/deep.txt/',
'deep/deeper/',
'deep/deeper/deeper.txt/',
'deep/deeper/deepest/',
'deep/deeper/deepest/deepest.txt/' ]
Dunno if maybe it should be require("glob/fnmatch")
or maybe segregate the constants somehow, but the GLOB_
constants and the FNM_
constants should probably not live on the same object, or else it's a bit tricky to translate them back and forth.
e0829f6 appears to open up a problem on Windows. When using Git bash I work on n:\
. npm, however, installs modules into c:\
. This leads to the following problem:
path: c:/Users/e5867u/AppData/Roaming/npm/node_modules/testacular/adapter/lib/jasmine.js
[ 'n:/c:/Users/e5867u/AppData/Roaming/npm/node_modules/testacular/adapter/lib/jasmine.js' ]
The problem is this: https://github.com/isaacs/node-glob/blob/master/glob.js#L326-L328
I tried printing the prefix before and after this if
:
prefix before: c:/Users/e5867u/AppData/Roaming/npm/node_modules/testacular/adapter/lib/jasmine.js
root: n:/
prefix after: n:\c:\Users\e5867u\AppData\Roaming\npm\node_modules\testacular\adapter\lib\jasmine.js
When going back to the code as it was before e0829f6, ie if (prefix.charAt(0) === "/" && !this.nomount) {
the code returns as expected:
path: c:/Users/e5867u/AppData/Roaming/npm/node_modules/testacular/adapter/lib/jasmine.js
[ 'c:/Users/e5867u/AppData/Roaming/npm/node_modules/testacular/adapter/lib/jasmine.js' ]
Using [email protected]
and given this directory / file structure:
$ tree deep
deep
├── deep.txt
└── deeper
├── deeper.txt
└── deepest
└── deepest.txt
The mark
option behavior appears to be inverted when the pattern ends with a /
:
var glob = require('glob');
// Expected behavior:
glob.sync('deep/**')
[ 'deep',
'deep/deep.txt',
'deep/deeper',
'deep/deeper/deeper.txt',
'deep/deeper/deepest',
'deep/deeper/deepest/deepest.txt' ]
glob.sync('deep/**', {mark: true})
[ 'deep/',
'deep/deep.txt',
'deep/deeper/',
'deep/deeper/deeper.txt',
'deep/deeper/deepest/',
'deep/deeper/deepest/deepest.txt' ]
glob.sync('deep/**/')
[ 'deep/',
'deep/deeper/',
'deep/deeper/deepest/' ]
// Inverse behavior:
glob.sync('deep/**/', {mark: true})
[ 'deep',
'deep/deeper',
'deep/deeper/deepest' ]
Could you add a (known) license to node-glob, please ?
I'm seeing the following in my application's output:
JOIN 5
JOIN 6
JOIN 0
JOIN 1
Could you make this optional (opt-in) ?
Hi, I'm quite new with node's stuff but I really want to understand why I failed,
I recently tried to install node-glob
but I failed for something which seems to be a compilation error.
Here is my bug report, hoping someone can point me out what is wrong
○ npm install -g glob
> [email protected] preinstall /home/blackpanther/local/node/lib/node_modules/glob
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /home/blackpanther/app/node
'configure' finished successfully (0.032s)
Waf: Entering directory `/home/blackpanther/app/node/lib/node_modules/glob/build'
[1/8] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_1.o
[2/8] cxx: deps/fnmatch/fnmatch.c -> build/default/deps/fnmatch/fnmatch_2.o
[3/8] cxx: src/glob.cc -> build/default/src/glob_3.o
[4/8] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_4.o
../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’:
../src/glob.cc:150:76: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(eio_req*)’ [-fpermissive]
/home/blackpanther/app/node/include/node/eio.h:334:10: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, eio_cb, void*)’ [-fpermissive]
Waf: Leaving directory `/home/blackpanther/app/node/lib/node_modules/glob/build'
Build failed: -> task failed (err #1):
{task: cxx glob.cc -> glob_3.o}
...
error installing [email protected] Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
error installing [email protected] `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
error installing [email protected] at ChildProcess.<anonymous> (/home/blackpanther/app/node/lib/node_modules/npm/lib/utils/exec.js:49:20)
error installing [email protected] at ChildProcess.emit (events.js:70:17)
error installing [email protected] at ChildProcess.onexit (child_process_legacy.js:246:12)
[email protected] preinstall: `node-waf clean || true; node-waf configure build`
`sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
Failed at the [email protected] preinstall script.
This is most likely a problem with the glob package,
not with npm itself.
Tell the author that this fails on your system:
node-waf clean || true; node-waf configure build
You can get their info via:
npm owner ls glob
There is likely additional logging output above.
System Linux 3.0.0-1-amd64
command "node" "/home/blackpanther/local/node/bin/npm" "install" "-g" "glob"
cwd /home/blackpanther
node -v v0.5.5-pre
npm -v 1.0.26
Additional logging details can be found in:
/home/blackpanther/npm-debug.log
I need to be able to filter the result of a glob operation using gitignore rules.
Would it make sense to add a filter plugin API which I can use to implement the gitignore rule set?
Should I use glob through another lib that already does something like this?
andreas@ubuntu:~/foo$ npm install [email protected]
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']
[email protected] ../node_modules/glob
├── [email protected]
├── [email protected] ([email protected])
└── [email protected]
> andreas@ubuntu:~/foo$ mkdir subdir
andreas@ubuntu:~/foo$ touch subdir/bar.txt
andreas@ubuntu:~/foo$ node
> require('glob').sync('**.txt');
skip final stat
[]
In 2.0.9 this (correctly) returned ['subdir/bar.txt']
.
It also looks like some debug console.error
statements made it into 3.1.1, I'm seeing a lot of skip final stat
and cb is function
messages when I run my test suite.
failing a few tests. fnmatch('foo/**/bar', 'foo/baz/asdf/bar')
should return true, but fnmatch('foo/*/bar', 'foo/baz/asdf/bar')
should return false.
If I pass glob
a search spec that includes a drive letter, it returns an empty array.
> process.cwd()
'C:\\dev'
> glob.sync('/temp/*.txt')
[ '\\temp/1.txt' ]
> glob.sync('c:/temp/*.txt')
[]
The two queries should return the same results (since C: is the current drive), but when I specify the full path including drive letter, glob
returns nothing.
I have a process which writes a large build package which I'm trying to convert to use node-glob rather than a homegrown glob routine. Unfortunately, while the sync() calls work great for read operations, it appears that graceful-fs is causing hanging write operations.
This is running on node 0.6.20 on Mac OSX 10.7.4. Changing glob.js to require('fs') fixes everything.
One question is would it be possible to change how glob operates such that you could choose the fs implementation you want? In my case I'd be happy with standard node.
Alternatively, can you suggest any reason why graceful-js would cause this behavior? I've tried adjusting the limits on open files etc. but that didnt' seem to have any effect.
../deps/fnmatch/fnmatch.c../deps/glob/glob.c:40:23::40:23 : sys/cdefs.hsys/cdefs.h: No such file or directory:
No such file or directory
In file included from ../deps/fnmatch/fnmatch.c:68:
../deps/fnmatch/fnmatch.h:54: error: expected constructor, destructor, or type conversion before "int"
../deps/fnmatch/fnmatch.h:54: error: expected `,' or `;' before "int"
In file included from /usr/include/string.h:33,
from ../deps/fnmatch/fnmatch.c:69:
/usr/include/iso/string_iso.h:51: error: expected constructor, destructor, or type conversion before "extern"
/usr/include/iso/string_iso.h:51: error: expected `,' or `;' before "extern"
In file included from ../deps/fnmatch/fnmatch.c:69:
/usr/include/string.h:74: error: `size_t' has not been declared
/usr/include/string.h:87: error: `size_t' has not been declared
/usr/include/string.h:92: error: `size_t' has not been declared
/usr/include/string.h:93: error: `size_t' has not been declared
/usr/include/string.h:95: error: `size_t' does not name a type
/usr/include/string.h:98: error: `size_t' has not been declared
/usr/include/string.h:99: error: `size_t' does not name a type
/usr/include/string.h:100: error: `size_t' does not name a type
In file included from ../src/glob_constants.h:2,
from ../src/glob.cc:7:
../deps/glob/glob.h:40:23: sys/cdefs.h: No such file or directory
../deps/fnmatch/fnmatch.c:129: error: `size_t' has not been declared
../deps/fnmatch/fnmatch.c:130: error: ISO C++ forbids declaration of `recursion' with no type
../deps/fnmatch/fnmatch.c: In function `int fnmatchx(const char*, const char*, int, int)':
../deps/fnmatch/fnmatch.c:172: error: `strchr' undeclared (first use this function)
../deps/fnmatch/fnmatch.c:172: error: (Each undeclared identifier is reported only once for each function it appears in.)
In file included from ../src/glob_constants.h:2,
from ../src/glob.cc:7:
../deps/glob/glob.h:102: error: expected constructor, destructor, or type conversion before "int"
../deps/glob/glob.h:102: error: expected `,' or `;' before "int"
In file included from ../src/glob_constants.h:3,
from ../src/glob.cc:7:
../deps/glob/glob.h:109: error: `__END_DECLS' does not name a type
In file included from /opt/nodejs/v0.2.6/include/node/node.h:5,
from ../src/glob_constants.h:4,
from ../src/glob.cc:7:
/opt/nodejs/v0.2.6/include/node/ev.h:44: error: expected constructor, destructor, or type conversion before "extern"
/opt/nodejs/v0.2.6/include/node/ev.h:44: error: expected `,' or `;' before "extern"
In file included from ../deps/glob/glob.c:88:
../deps/glob/glob.h:102: error: expected constructor, destructor, or type conversion before "int"
../deps/glob/glob.h:102: error: expected `,' or `;' before "int"
In file included from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdio.h:14,
from /usr/include/pwd.h:41,
from ../deps/glob/glob.c:89:
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h:43: error: expected constructor, destructor, or type conversion before "typedef"
/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/include/stdarg.h:43: error: expected `,' or `;' before "typedef"
In file included from /usr/include/stdlib.h:39,
from ../src/glob.cc:11:
/usr/include/sys/wait.h:104: error: `idtype_t' was not declared in this scope
/usr/include/sys/wait.h:104: error: expected primary-expression before ',' token
/usr/include/sys/wait.h:104: error: `siginfo_t' was not declared in this scope
/usr/include/sys/wait.h:104: error: expected primary-expression before ',' token
/usr/include/sys/wait.h:104: error: expected primary-expression before "int"
/usr/include/sys/wait.h:104: error: initializer expression list treated as compound expression
../deps/glob/glob.c: In function `int glob3(Char*, Char*, Char*, const Char*, const Char*, const Char*, glob_t*, size_t*)':
../deps/glob/glob.c:857: error: expected primary-expression before "struct"
../deps/glob/glob.c:857: error: expected `)' before "struct"
../src/glob.cc: In function `v8::Handle<v8::Value> FNMatch(const v8::Arguments&)':
../src/glob.cc:71: error: `fnmatch' undeclared (first use this function)
../src/glob.cc:71: error: (Each undeclared identifier is reported only once for each function it appears in.)
../src/glob.cc: In function `int EIO_Glob(eio_req*)':
../src/glob.cc:87: error: `glob' undeclared (first use this function)
../src/glob.cc: In function `int EIO_GlobAfter(eio_req*)':
../src/glob.cc:92: error: `ev_unref' undeclared (first use this function)
../src/glob.cc: In function `v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)':
../src/glob.cc:140: error: `ev_ref' undeclared (first use this function)
../src/glob.cc: In function `v8::Handle<v8::Value> GlobSync(const v8::Arguments&)':
../src/glob.cc:158: error: `glob' undeclared (first use this function)
Since a full install location isn't specified in wscript, systems that build modules in a separate location to where they're checked out (ndistro) fail on including a successfully compiled / installed node-glob module, like in this gist.
I realize these are "evil" for a glob, but I would normally expect this:
"//?/C:/*"
To return results. Realistically, on win32, it's reasonable to check if the path starts with //?/ (or ?\ but that's havoc, I understand) and stop right there.
I think the "root cause" is actually in minimatch, because it turns the pattern into /?/.
This is probably a pretty low priority issue. It's honestly not uncommon for UNC paths not to work sometimes in programs, and except for remote resources it's easy enough to mount the volume to a path or use the drive letter.
-[Unknown]
if glob is bundled with npm I get the following error
Error: Cannot find module '../build/default/glob'
at Function._resolveFilename (module.js:299:11)
at Function._load (module.js:245:25)
at require (module.js:327:19)
at Object. (/Users/weepy/Projects/mewcal/node_modules/.npm/glob/2.0.5/package/lib/glob.js:3:15)
It happens to even the best of us, I guess :)
andreas@ubuntu:~$ npm install -g [email protected]
> [email protected] preinstall /home/andreas/.local/lib/node_modules/glob
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /home/andreas/.node_libraries
Checking for node prefix : ok /home/andreas/.local
'configure' finished successfully (0.125s)
Waf: Entering directory `/Users/isaacs/dev-src/js/node-glob/build'
Waf: Leaving directory `/Users/isaacs/dev-src/js/node-glob/build'
Traceback (most recent call last):
File "/home/andreas/.local/bin/node-waf", line 16, in <module>
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
File "/home/andreas/.local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
prepare_impl(t, cwd, ver, wafdir)
File "/home/andreas/.local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
main()
File "/home/andreas/.local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
fun(ctx)
File "/home/andreas/.local/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
return build_impl(bld)
File "/home/andreas/.local/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
bld.compile()
File "/home/andreas/.local/bin/../lib/node/wafadmin/Build.py", line 268, in compile
os.chdir(self.bldnode.abspath())
OSError: [Errno 2] No such file or directory: '/Users/isaacs/dev-src/js/node-glob/build'
npm ERR! error installing [email protected] Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! error installing [email protected] at ChildProcess.<anonymous> (/home/andreas/.local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected] at ChildProcess.onexit (child_process.js:192:12)
npm ERR! [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the glob package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls glob
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.35-28-generic
npm ERR! command "node" "/home/andreas/.local/bin/npm" "install" "-g" "[email protected]"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/andreas/.npm/glob/npm-debug.log
npm not ok
Here's the problem:
andreas@ubuntu:~$ tar tz < ~/.npm/glob/2.0.7/package.tgz
package/wscript
package/LICENCE
package/README.md
package/.gitignore
package/Makefile
package/package.json
package/lib/glob.js
package/src/glob_constants.h
package/src/glob.cc
package/deps/fnmatch/LICENSE
package/deps/fnmatch/fnmatch.c
package/deps/fnmatch/fnmatch.h
package/deps/glob/LICENSE
package/deps/glob/glob.c
package/deps/glob/glob.h
package/test/test.js
package/test/foo/bar
package/test/foo/baz/bar
package/test/foo/baz/quux/bar
package/build/config.log
package/build/.wafpickle-7
package/build/c4che/default.cache.py
package/build/c4che/build.config.py
package/build/default/glob_g.node
package/build/default/glob.node
package/build/default/src/glob_6.o
package/build/default/src/glob_3.o
package/build/default/deps/fnmatch/fnmatch_2.o
package/build/default/deps/fnmatch/fnmatch_5.o
package/build/default/deps/glob/glob_4.o
package/build/default/deps/glob/glob_1.o
There are a few rogue console.logs()'s in glob.js.
Checking for program g++ or c++ : /usr/lib/ccache/bin/g++
Checking for program cpp : /usr/lib/ccache/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr
'configure' finished successfully (0.036s)
Waf: Entering directory /home/gildo/pub/npm/node_modules/glob/build' [1/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_1.o [2/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_2.o [3/8] cxx: src/glob.cc -> build/Release/src/glob_3.o [4/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_4.o [5/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_5.o [6/8] cxx: src/glob.cc -> build/Release/src/glob_6.o ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’: ../src/glob.cc:150:76: error: invalid conversion from ‘int (*)(eio_req*) {aka int (*)(eio_req*)}’ to ‘void (*)(eio_req*) {aka void (*)(eio_req*)}’ [-fpermissive] /usr/include/node/eio.h:334:10: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, eio_cb, void*)’ [-fpermissive] ../src/glob.cc: In function ‘int EIO_Glob(eio_req*)’: ../src/glob.cc:87:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] ../src/glob.cc: In function ‘int EIO_GlobAfter(eio_req*)’: ../src/glob.cc:101:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’: ../src/glob.cc:150:76: error: invalid conversion from ‘int (*)(eio_req*) {aka int (*)(eio_req*)}’ to ‘void (*)(eio_req*) {aka void (*)(eio_req*)}’ [-fpermissive] /usr/include/node/eio.h:334:10: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, eio_cb, void*)’ [-fpermissive] ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobSync(const v8::Arguments&)’: ../src/glob.cc:170:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] ../src/glob.cc:175:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Waf: Leaving directory
/home/gildo/pub/npm/node_modules/glob/build'
Build failed:
-> task failed (err #1):
{task: cxx glob.cc -> glob_3.o}
-> task failed (err #1):
{task: cxx glob.cc -> glob_6.o}
npm ERR! error installing [email protected] Error: [email protected] preinstall: node-waf clean || true; node-waf configure build
npm ERR! error installing [email protected] sh "-c" "node-waf clean || true; node-waf configure build"
failed with 1
npm ERR! error installing [email protected] at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:70:17)
npm ERR! error installing [email protected] at ChildProcess.onexit (child_process_legacy.js:246:12)
npm ERR! [email protected] preinstall: node-waf clean || true; node-waf configure build
npm ERR! sh "-c" "node-waf clean || true; node-waf configure build"
failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the glob package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls glob
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.0-ARCH
npm ERR! command "node" "/usr/bin/npm" "install" "glob"
npm ERR! cwd /home/gildo/pub/npm
npm ERR! node -v v0.5.5-pre
npm ERR! npm -v 1.0.27
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/gildo/pub/npm/npm-debug.log
As far as I can tell "extended globs" have been implemented independently in Ruby's dir.c, bash 4.01's lib/glob.c, in zsh, and somewhere in the Perl ecosystem.
GNU Bash's glob is GPL, of course, which is unfortunate. Ruby's is GPL or some custom stuff, probably workable. Bash's and zsh's are the best in terms of spec compliance and general utility, but both are less than completely independent from their respective programs. Ruby's seems pretty complete as well, but I'm not sure how great a fit it is for node's use.
Another option is to take a look at the posix spec and implement it that way. But that sucks.
This works:
GLOB(path1 + "/**", {
cwd: path1
}, function (err, files)
{
});
GLOB(path2 + "/**", {
cwd: path2
}, function (err, files)
{
});
This does NOT work but should:
GLOB("**", {
cwd: path1
}, function (err, files)
{
});
GLOB("**", {
cwd: path2
}, function (err, files)
{
});
The current working directory shouldn't be relevant when globbing an absolute path, but:
andreas@ubuntu:~$ npm install [email protected]
[...]
andreas@ubuntu:~$ node
> require('glob').sync('/home/andreas/foo');
[ 'foo' ]
Same thing happens when the pattern contains wildcards.
It worked fine in previous versions:
andreas@ubuntu:~$ npm install [email protected]
[...]
andreas@ubuntu:~$ node
> require('glob').sync('/home/andreas/foo');
[ '/home/andreas/foo/' ]
Use https://github.com/isaacs/minimatch instead of the bsd glob.c file.
Compilation is an unnecessary evil in this case.
var glob = require('glob');
glob(__dirname, { mark: true }, function (err, matches) {
console.log(matches); // Contains the __dirname with \ added to the end
});
var glob = require('glob');
glob(__dirname + '\\', { mark: true }, function (err, matches) {
console.log(matches); // Contains the __dirname without the \ or / added to the end
});
I know that in this case, using glob is not necessary. Thing is that the pattern is dynamically assigned.
This only happens on windows
. In my MacOSX
, the example above works as expected.
If nonull
was set, shouldn't the returned array always contain at least something? I'm using [email protected]
.
var glob = require('glob');
glob.sync('xyz', {nonull: true}); // []
glob('xyz', {nonull: true}, function(err, files) {
console.log(err, files); // logs: null []
});
This works:
var glob = require('glob');
var path = require('path');
glob('**/*', function (err, matches) {
console.log(matches); // matches is ok
});
This doesn't work:
var glob = require('glob');
var path = require('path');
glob(__dirname + '/**/*', function (err, matches) {
console.log(matches); // matches is []
});
Happens in windows, dunno in other OS's.
I'd like to request that node-glob
store Stats objects, instead / in addition to storing whether the path exists / is a directory. I'm building my own filesystem library, and stat the globbed paths all over again.
isabel:webclient pyrotechnick$ npm i glob
> [email protected] preinstall /Users/pyrotechnick/webclient/node_modules/glob
> node-waf clean || true; node-waf configure build
Nothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local/lib/node_modules
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.236s)
Waf: Entering directory `/Users/pyrotechnick/webclient/node_modules/glob/build'
[1/8] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_1.o
[2/8] cxx: deps/fnmatch/fnmatch.c -> build/default/deps/fnmatch/fnmatch_2.o
[3/8] cxx: src/glob.cc -> build/default/src/glob_3.o
[4/8] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_4.o
[5/8] cxx: deps/fnmatch/fnmatch.c -> build/default/deps/fnmatch/fnmatch_5.o
[6/8] cxx: src/glob.cc -> build/default/src/glob_6.o
../src/glob.cc: In function ‘int EIO_Glob(eio_req*)’:
../src/glob.cc:87: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc: In function ‘int EIO_GlobAfter(eio_req*)’:
../src/glob.cc:101: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘glob_t*’
../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘glob_request*’
../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’:
../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘glob_request*’
../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘eio_req*’
../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobSync(const v8::Arguments&)’:
../src/glob.cc:170: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
../src/glob.cc:175: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘const char*’
[7/8] cxx_link: build/default/src/glob_3.o build/default/deps/glob/glob_1.o build/default/deps/fnmatch/fnmatch_2.o -> build/default/glob.node
[8/8] cxx_link: build/default/src/glob_6.o build/default/deps/glob/glob_4.o build/default/deps/fnmatch/fnmatch_5.o -> build/default/glob_g.node
Waf: Leaving directory `/Users/pyrotechnick/webclient/node_modules/glob/build'
'build' finished successfully (1.250s)
[email protected] ./node_modules/glob
28 tests fail
On OS X 10.7.2 using node 0.6.7
https://gist.github.com/1713383
Found this when debugging why my negating patterns where not matching.
All the minimatch tests pass on my machine.
The fix from #53 causes paths prefixed with /
to not mount the path on top of the passed in root path.
When I pass in { root: 'c:\foo' }
or something like that, and try to match /bar
i will end up with c:\bar
instead of what I expect, which is c:\foo\bar
. Or at least I've understood that's how it works from reading the documentation.
root
The place where patterns starting with /
will be mounted onto. Defaults to path.resolve(options.cwd, "/")
(/
on Unix systems, and C:\
or some such on Windows.)path.resolve('/foo/bar', './baz')
// returns
'/foo/bar/baz'
path.resolve('/foo/bar', '/tmp/file/')
// returns
'/tmp/file'
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif')
// if currently in /home/myself/node, it returns
'/home/myself/node/wwwroot/static_files/gif/image.gif'
Passing in a leading /
to any argument of path.resolve()
seems to mount it at root. My suggestion is to not try and do too much to Windows absolute paths in prefix
.
It all works for me when I uncomment these lines, but I understand it breaks the previous issue: https://github.com/isaacs/node-glob/blob/master/glob.js#L369-L370
Sorry to report that the installation is failing under OSX Lion, with node 0.5.7:
$ npm install glob
[email protected] preinstall /Users/danski/Sites/spah/node_modules/glob
node-waf clean || true; node-waf configure buildNothing to clean (project not configured)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.149s)
Waf: Entering directory/Users/danski/Sites/spah/node_modules/glob/build' [1/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_1.o [2/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_2.o [3/8] cxx: src/glob.cc -> build/Release/src/glob_3.o [4/8] cxx: deps/glob/glob.c -> build/Release/deps/glob/glob_4.o [5/8] cxx: deps/fnmatch/fnmatch.c -> build/Release/deps/fnmatch/fnmatch_5.o [6/8] cxx: src/glob.cc -> build/Release/src/glob_6.o ../src/glob.cc: In function ‘int EIO_Glob(eio_req*)’: ../src/glob.cc:87: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:87: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc: In function ‘int EIO_GlobAfter(eio_req*)’: ../src/glob.cc:101: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:101: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_t*’ ../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_t*’ ../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:120: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_request*’ ../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_request*’ ../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:122: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’: ../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_request*’ ../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘glob_request*’ ../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:142: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:150: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(> eio_req*)’ ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobAsync(const v8::Arguments&)’: ../src/glob.cc:150: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(> eio_req*)’ ../src/glob.cc:150: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(> eio_req*), int, int (*)(eio_req*), void*)’ ../src/glob.cc:150: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(> eio_req*), int, int (*)(eio_req*), void*)’ ../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘eio_req*’ ../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘eio_req*’ ../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:151: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc: In function ‘v8::Handle<v8::Value> GlobSync(const v8::Arguments&)’: ../src/glob.cc:170: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:170: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:175: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ ../src/glob.cc:175: warning: format ‘%i’ expects type ‘int’, but argument 3 has type > ‘const char*’ Waf: Leaving directory
/Users/danski/Sites/spah/node_modules/glob/build'
Build failed:
-> task failed (err #1):
{task: cxx glob.cc -> glob_3.o}
-> task failed (err #1):
{task: cxx glob.cc -> glob_6.o}
npm ERR! error installing [email protected] Error: [email protected] preinstall:node-waf clean || > true; node-waf configure build
npm ERR! error installing [email protected]sh "-c" "node-waf clean || true; node-waf > configure build"
failed with 1
npm ERR! error installing [email protected] at ChildProcess. (> /usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:70:17)
npm ERR! error installing [email protected] at maybeExit (child_process_uv.js:227:16)
npm ERR! error installing [email protected] at Process.onexit (child_process_uv.js:262:5)
npm ERR! [email protected] preinstall:node-waf clean || true; node-waf configure build
npm ERR!sh "-c" "node-waf clean || true; node-waf configure build"
failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the glob package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls glob
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "glob"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/danski/Sites/spah/npm-debug.log
npm not ok
'configure' finished successfully (0.397s)
Waf: Entering directory `/usr/local/lib/node/.npm/glob/2.0.2/package/build'
[1/4] cxx: deps/glob/glob.c -> build/default/deps/glob/glob_1.o
[2/4] cxx: deps/fnmatch/fnmatch.c -> build/default/deps/fnmatch/fnmatch_2.o
[3/4] cxx: src/glob.cc -> build/default/src/glob_3.o
[4/4] cxx_link: build/default/src/glob_3.o build/default/deps/glob/glob_1.o build/default/deps/fnmatch/fnmatch_2.o -> build/default/glob.node
/usr/bin/ld: default/deps/glob/glob_1.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
default/deps/glob/glob_1.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Waf: Leaving directory `/usr/local/lib/node/.npm/glob/2.0.2/package/build'
Build failed: -> task failed (err #1):
{task: cxx_link glob_3.o,glob_1.o,fnmatch_2.o -> glob.node}
npm info [email protected] Failed to exec preinstall script
npm ERR! install failed Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! install failed `sh` failed with 1
npm ERR! install failed at ChildProcess.<anonymous> (/usr/local/lib/node/.npm/npm/0.2.17/package/lib/utils/exec.js:25:18)
npm ERR! install failed at ChildProcess.emit (events.js:45:17)
npm ERR! install failed at ChildProcess.onexit (child_process.js:171:12)
npm info install failed rollback
I get this error when attempting to run 'npm install glob.'
It's planed to support windows platform too?
Hey,
I'm having an issue running "npm bundle" with npm version 0.3.18 and it seems to be failing with glob. Running "npm bundle install glob" gives the following output:
# npm bundle install glob
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
chdir(): Permission denied
npm info [email protected] Failed to exec preinstall script
npm ERR! install failed Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! install failed `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 127
npm ERR! install failed at ChildProcess.<anonymous> (/usr/lib/node/.npm/npm/0.3.18/package/lib/utils/exec.js:49:20)
npm ERR! install failed at ChildProcess.emit (events.js:45:17)
npm ERR! install failed at ChildProcess.onexit (child_process.js:171:12)
npm info install failed rollback
npm info uninstall [ '[email protected]' ]
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info auto-deactive not symlink
npm info postuninstall [email protected]
npm info uninstall [email protected] complete
npm info install failed rolled back
npm ERR! Error: [email protected] preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 127
npm ERR! at ChildProcess.<anonymous> (/usr/lib/node/.npm/npm/0.3.18/package/lib/utils/exec.js:49:20)
npm ERR! at ChildProcess.emit (events.js:45:17)
npm ERR! at ChildProcess.onexit (child_process.js:171:12)
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the glob package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls glob
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-305-ec2
npm ERR! argv { remain: [ 'glob' ],
npm ERR! argv cooked:
npm ERR! argv [ 'bundle',
npm ERR! argv 'install',
npm ERR! argv 'glob' ],
npm ERR! argv original:
npm ERR! argv [ 'bundle',
npm ERR! argv 'install',
npm ERR! argv 'glob' ] }
npm not ok
Trying a pure "npm install glob" the install runs correctly and I'm able to require('glob'). Even after doing this "npm bundle" fails. I'm not sure how to diagnose the problem further, so any advice would be greatly appreciated!
Thanks!
Greg
Beginning a pattern with ! seems to be broken. The result actually matches the non-negated pattern... so for example:
glob('!package.json', function(err, res)...
returns res as ['package.json']
, whereas
glob('./!(package.json)', function(err, res)...
returns an array containing all files/directories in the cwd except package.json, as expected.
I'm using glob 3.1.5, node 0.4.12, npm 1.0.103
I can't use glob.sync. Here is node output:
$ node
> var glob = require("glob");
> glob.sync("/tmp/*")
TypeError: object is not a function
at Object.CALL_NON_FUNCTION (native)
at Glob._process (/usr/local/lib/node_modules/glob/glob.js:234:3)
at Glob.iterator (/usr/local/lib/node_modules/glob/glob.js:157:10)
at native
at Array.forEach (native)
at new Glob (/usr/local/lib/node_modules/glob/glob.js:155:22)
at glob (/usr/local/lib/node_modules/glob/glob.js:57:11)
at Function.globSync [as sync] (/usr/local/lib/node_modules/glob/glob.js:76:10)
at [object Context]:1:6
at Interface.<anonymous> (repl.js:179:22)
npm test glob also fails.
require("glob").glob("*/.js", function (err, paths) {})
[1] 6330 segmentation fault node
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.