cmusphinx / node-pocketsphinx

Pocketsphinx bindings for Node.JS
Other
242 stars 47 forks source link

npm install is failing #17

Closed kksharma1618 closed 8 years ago

kksharma1618 commented 8 years ago

Hey,

I will really appreciate if you can provide any help with this issue.

1) Installed https://github.com/cmusphinx/sphinxbase 2) Installed https://github.com/cmusphinx/pocketsphinx 3) Installed swig 3.0.2 using brew 4) pkgconfig 0.28 is already installed 5) node version is 4.2.4 6) npm version is 2.14.12 7) Ran PKG_CONFIG_PATH=/usr/local/bin/pkg-config sudo npm install pocketsphinx my pgk-config is at that path

Attaching npm-debug log

npm-debug.log.txt

nshmyrev commented 8 years ago

PKG_CONFIG_PATH=/usr/local/bin/pkg-config sudo npm install pocketsphinx

must be

 PKG_CONFIG_PATH=/usr/local/lib/pkg-config sudo npm install pocketsphinx

with local/lib instead local/bin.

kksharma1618 commented 8 years ago

Hey @nshmyrev ,

Thanks for the quick reply. I used

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig sudo npm install pocketsphinx

Failed again. Attached is the debug log. (I also checked. /usr/local/lib/pkgconfig file is there).

npm-debug.log.txt

Here is the command line output:

kkmac:kkvideomasher krishnakantsharma$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig sudo npm install pocketsphinx
npm WARN package.json kkvideomasher@1.0.0 No description
npm WARN package.json kkvideomasher@1.0.0 No README data
-
> pocketsphinx@5.0.5 install /Users/krishnakantsharma/kkwork/local/kkvideomasher/node_modules/pocketsphinx
> node-gyp rebuild

  ACTION Checking for sphinxbase and pocketsphinx version 5prealpha with pkg-config .
  ACTION Creating sphinxbase wrapper sb.cpp
  CXX(target) Release/obj.target/SphinxBase/wrap_sb.o
In file included from ../wrap_sb.cpp:3:
../sb.cpp:761:7: error: no member named 'ThrowException' in namespace 'v8'
  v8::ThrowException(v8::Exception::Error(v8::String::New(msg)));
  ~~~~^
../sb.cpp:761:55: error: no member named 'New' in 'v8::String'
  v8::ThrowException(v8::Exception::Error(v8::String::New(msg)));
                                          ~~~~~~~~~~~~^
../sb.cpp:791:44: error: no member named 'New' in 'v8::String'
    err = v8::Exception::Error(v8::String::New(msg));
                               ~~~~~~~~~~~~^
../sb.cpp:793:11: error: no type named 'ThrowException' in namespace 'v8'
      v8::ThrowException(err);
      ~~~~^
../sb.cpp:828:13: error: no member named 'AdjustAmountOfExternalAllocatedMemory'
      in 'v8::V8'
    v8::V8::AdjustAmountOfExternalAllocatedMemory(SWIGV8_AVG_OBJ_SIZE);
    ~~~~~~~~^
../sb.cpp:834:12: error: no member named 'Dispose' in
      'v8::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    handle.Dispose();
    ~~~~~~ ^
../sb.cpp:840:12: error: no member named 'Clear' in 'v8::Persistent<v8::Object,
      v8::NonCopyablePersistentTraits<v8::Object> >'
    handle.Clear();
    ~~~~~~ ^
../sb.cpp:841:13: error: no member named 'AdjustAmountOfExternalAllocatedMemory'
      in 'v8::V8'
    v8::V8::AdjustAmountOfExternalAllocatedMemory(-SWIGV8_AVG_OBJ_SIZE);
    ~~~~~~~~^
../sb.cpp:864:19: error: calling a protected constructor of class
      'v8::HandleScope'
  v8::HandleScope scope;
                  ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:885:13: note: 
      declared protected here
  V8_INLINE HandleScope() {}
            ^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:956:19: error: no member named 'MakeWeak' in
      'v8::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_Cl...
    ~~~~~~~~~~~~~ ^
../sb.cpp:958:19: error: no member named 'MakeWeak' in
      'v8::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Prox...
    ~~~~~~~~~~~~~ ^
../sb.cpp:971:19: error: calling a protected constructor of class
      'v8::HandleScope'
  v8::HandleScope scope;
                  ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:885:13: note: 
      declared protected here
  V8_INLINE HandleScope() {}
            ^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:985:19: error: calling a protected constructor of class
      'v8::HandleScope'
  v8::HandleScope scope;
                  ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:885:13: note: 
      declared protected here
  V8_INLINE HandleScope() {}
            ^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:989:18: error: no member named 'Close' in 'v8::HandleScope'
    return scope.Close(v8::Null());
           ~~~~~ ^
../sb.cpp:989:33: error: too few arguments to function call, single argument
      'isolate' was not specified
    return scope.Close(v8::Null());
                       ~~~~~~~~ ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:316:3: note: 'Null'
      declared here
  friend Local<Primitive> Null(Isolate* isolate);
  ^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:1011:16: error: no member named 'Close' in 'v8::HandleScope'
  return scope.Close(result);
         ~~~~~ ^
../sb.cpp:1030:19: error: calling a protected constructor of class
      'v8::HandleScope'
  v8::HandleScope scope;
                  ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:885:13: note: 
      declared protected here
  V8_INLINE HandleScope() {}
            ^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:1050:38: error: too few arguments to function call, expected 2, have 1
  jsresult =  v8::Boolean::New(result);
              ~~~~~~~~~~~~~~~~       ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:7603:1: note: 'New'
      declared here
Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
^
In file included from ../wrap_sb.cpp:3:
../sb.cpp:1055:31: error: too few arguments to function call, single argument
      'isolate' was not specified
  SWIGV8_RETURN(v8::Undefined());
                ~~~~~~~~~~~~~ ^
../sb.cpp:811:54: note: expanded from macro 'SWIGV8_RETURN'
#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
                                                     ^
/Users/krishnakantsharma/.node-gyp/4.2.4/include/node/v8.h:315:3: note: 
      'Undefined' declared here
  friend Local<Primitive> Undefined(Isolate* isolate);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/SphinxBase/wrap_sb.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/krishnakantsharma/kkwork/local/kkvideomasher/node_modules/pocketsphinx
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pocketsphinx"
npm ERR! node v4.2.4
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! pocketsphinx@5.0.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pocketsphinx@5.0.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the pocketsphinx package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pocketsphinx
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/krishnakantsharma/kkwork/local/kkvideomasher/npm-debug.log
nshmyrev commented 8 years ago

Please update swig, you need at least 3.0.7.

I have updated readme about that.

orgicus commented 8 years ago

Hi,

I've tried simply using install, but I got this warning, then npm exited:

npm WARN lifecycle pocketsphinx@5.0.5~install: cannot run in wd %s %s (wd=%s) pocketsphinx@5.0.5 node-gyp rebuild /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx

The verbose output looks like this:

npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '--verbose' ]
npm info using npm@3.3.12
npm info using node@v5.5.0
npm verb lock using /Users/georgeprofenza/.npm/_locks/staging-62bcc3e2b3d0287d.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/node_modules/.staging
npm verb unlock done using /Users/georgeprofenza/.npm/_locks/staging-62bcc3e2b3d0287d.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/node_modules/.staging
npm info lifecycle pocketsphinx@5.0.5~preinstall: pocketsphinx@5.0.5
npm info linkStuff pocketsphinx@5.0.5
npm verb linkBins pocketsphinx@5.0.5
npm verb linkMans pocketsphinx@5.0.5
npm info lifecycle pocketsphinx@5.0.5~install: pocketsphinx@5.0.5
npm WARN lifecycle pocketsphinx@5.0.5~install: cannot run in wd %s %s (wd=%s) pocketsphinx@5.0.5 node-gyp rebuild /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx
npm info lifecycle pocketsphinx@5.0.5~postinstall: pocketsphinx@5.0.5
npm info lifecycle pocketsphinx@5.0.5~prepublish: pocketsphinx@5.0.5
npm verb exit [ 0, true ]
npm info ok 

running

PKG_CONFIG_PATH=/usr/local/lib/pkg-config sudo npm install pocketsphinx --verbose

yields:

npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   'pocketsphinx',
npm verb cli   '--verbose' ]
npm info using npm@3.3.12
npm info using node@v5.5.0
npm verb get https://registry.npmjs.org/pocketsphinx not expired, no request
npm verb stack Error: Refusing to install pocketsphinx as a dependency of itself
npm verb stack     at checkSelf (/usr/local/lib/node_modules/npm/lib/install/validate-args.js:40:14)
npm verb stack     at Array.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm verb stack     at LOOP (/usr/local/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
npm verb stack     at chain (/usr/local/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:5)
npm verb stack     at /usr/local/lib/node_modules/npm/lib/install/validate-args.js:15:5
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
npm verb stack     at Array.forEach (native)
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
npm verb stack     at Array.forEach (native)
npm verb stack     at asyncMap (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
npm verb cwd /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pocketsphinx" "--verbose"
npm ERR! node v5.5.0
npm ERR! npm  v3.3.12
npm ERR! code ENOSELF

npm ERR! Refusing to install pocketsphinx as a dependency of itself
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ 1, true ]

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/npm-debug.log

I've also attached the log: npm-debug.log.txt

In terms of setup, I've downloaded, compiled and installed sphinxbase and pocketsphinx, but please note I am using the latest files from sourceforge (not github). The only sphinx related github repo I'm using at the moment is this one.

My folder structure looks like this:

..
├── Language\ Models
├── node-pocketsphinx
├── pocketsphinx-5prealpha
├── pocketsphinx-5prealpha.tar.gz
├── sphinxbase
├── sphinxbase-5prealpha.tar.gz
├── sphinxtrain-5prealpha
└── sphinxtrain-5prealpha.tar.gz

and I've checked swig version:

SWIG Version 3.0.7

Compiled with /usr/bin/clang++ [x86_64-apple-darwin14.4.0]

Configured options: +pcre

I'm fairly new to this, so any hints/tips will be helpful.

Thank you, George

nshmyrev commented 8 years ago

You are trying to run npm install from inside node-pocketsphinx, it can not do because node-pocketsphinx is already the current folder. Inside node-pocketsphinx run node-gyp -v rebuild instead. Or remove node-pocketsphinx and run npm install from other folder.

orgicus commented 8 years ago

Thank you for the fast response. I've re-read your message a few times, but unfortunately I haven't fully understood what you meant.

I've tried to use node-gyp -v rebuild:

gp-mb:node-pocketsphinx georgeprofenza$ node-gyp -v rebuild
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/bin/node-gyp',
gyp verb cli   '-v',
gyp verb cli   'rebuild' ]
gyp info using node-gyp@1.0.3
gyp info using node@5.5.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /Users/georgeprofenza/anaconda/bin/python
gyp verb check python version `python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: v5.5.0
gyp verb command install [ 'v5.5.0' ]
gyp verb install input version string "v5.5.0"
gyp verb install installing version: 5.5.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 5.5.0
gyp verb build dir attempting to create "build" dir: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/build
gyp verb build dir "build" dir needed to be created? /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/config.gypi
gyp verb common.gypi checking for gypi file: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/georgeprofenza/.node-gyp/5.5.0/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/georgeprofenza/.node-gyp/5.5.0',
gyp info spawn args   '-Dmodule_root_dir=/Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: /Users/georgeprofenza/.node-gyp/5.5.0/common.gypi not found (cwd: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "-v" "rebuild"
gyp ERR! cwd /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 

I have also created a separate folder and cloned sphinx, pocketsphinx and node-pocketsphinx:

├── node-pocketsphinx
├── pocketsphinx
└── sphinxbase

I tried a fresh start here, first compiled and installed sphinxbase, then pocketsphinx, using the the README notes from the repositories.

I didn't understand what you meant by

Or remove node-pocketsphinx and run npm install from other folder.

Which is the other folder ?

I've tried using npm install, this time in this fresh folder and it seems to have finished, but I'm not sure it worked:

gp-mb:node-pocketsphinx georgeprofenza$ sudo npm install --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '--verbose' ]
npm info using npm@3.3.12
npm info using node@v5.5.0
npm verb lock using /Users/georgeprofenza/.npm/_locks/staging-18172aeb212e1ca1.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging
npm verb unlock done using /Users/georgeprofenza/.npm/_locks/staging-18172aeb212e1ca1.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging
npm info lifecycle pocketsphinx@5.0.5~preinstall: pocketsphinx@5.0.5
npm info linkStuff pocketsphinx@5.0.5
npm verb linkBins pocketsphinx@5.0.5
npm verb linkMans pocketsphinx@5.0.5
npm info lifecycle pocketsphinx@5.0.5~install: pocketsphinx@5.0.5
npm WARN lifecycle pocketsphinx@5.0.5~install: cannot run in wd %s %s (wd=%s) pocketsphinx@5.0.5 node-gyp rebuild /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx
npm info lifecycle pocketsphinx@5.0.5~postinstall: pocketsphinx@5.0.5
npm info lifecycle pocketsphinx@5.0.5~prepublish: pocketsphinx@5.0.5
npm verb exit [ 0, true ]
npm info ok 

I tried tried to run the demo, but it didn't work:

gp-mb:node-pocketsphinx georgeprofenza$ cd demo/
gp-mb:demo georgeprofenza$ ls
test.js
gp-mb:demo georgeprofenza$ node test.js 
module.js:341
    throw err;
    ^

Error: Cannot find module './build/Release/PocketSphinx.node'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/index.js:1:82)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
nshmyrev commented 8 years ago

From the log it seems you have an issue with node-gyp install, this is a reason of your troubles. The offending line is

gyp: /Users/georgeprofenza/.node-gyp/5.5.0/common.gypi not found (cwd: /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/node-pocketsphinx) while reading includes of binding.gyp while trying to load binding.gyp

Please check for further details:

http://stackoverflow.com/questions/17967546/common-gypi-not-found-error-in-node-js

orgicus commented 8 years ago

Thanks again for your help.

I'll admit this node-gyp is a bit beyond me at the moment, but I tried multiple suggestions based on the post you've linked to.

At the moment I've tried the first two suggestions (remove ~/.node-gyp files and installing and removing ~/.node-gyp/5.5.0 folder, then downloading common.gypi) but I'm still getting errors.

I started getting some different errors:

gp-mb:node-pocketsphinx georgeprofenza$ PKG_CONFIG_PATH=/usr/local/lib/pkg-config sudo npm install pocketsphinx --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   'pocketsphinx',
npm verb cli   '--verbose' ]
npm info using npm@3.3.12
npm info using node@v5.5.0
npm verb request uri https://registry.npmjs.org/pocketsphinx
npm verb request no auth needed
npm info attempt registry request try #1 at 8:24:31 PM
npm verb request id a86ab4fcb0e0fefe
npm verb etag "51CF6L724Z4XBK0IE3JPO4CW9"
npm http request GET https://registry.npmjs.org/pocketsphinx
npm http 304 https://registry.npmjs.org/pocketsphinx
npm verb headers { date: 'Thu, 18 Feb 2016 20:24:31 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: '"51CF6L724Z4XBK0IE3JPO4CW9"',
npm verb headers   age: '0',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-lhr6333-LHR',
npm verb headers   'x-cache': 'MISS',
npm verb headers   'x-cache-hits': '0',
npm verb headers   'x-timer': 'S1455827071.820338,VS0,VE94',
npm verb headers   vary: 'Accept' }
npm verb etag https://registry.npmjs.org/pocketsphinx from cache
npm verb get saving pocketsphinx to /Users/georgeprofenza/.npm/registry.npmjs.org/pocketsphinx/.cache.json
npm verb stack Error: Refusing to install pocketsphinx as a dependency of itself
npm verb stack     at checkSelf (/usr/local/lib/node_modules/npm/lib/install/validate-args.js:40:14)
npm verb stack     at Array.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm verb stack     at LOOP (/usr/local/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
npm verb stack     at chain (/usr/local/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:5)
npm verb stack     at /usr/local/lib/node_modules/npm/lib/install/validate-args.js:15:5
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
npm verb stack     at Array.forEach (native)
npm verb stack     at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
npm verb stack     at Array.forEach (native)
npm verb stack     at asyncMap (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
npm verb cwd /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pocketsphinx" "--verbose"
npm ERR! node v5.5.0
npm ERR! npm  v3.3.12
npm ERR! code ENOSELF

npm ERR! Refusing to install pocketsphinx as a dependency of itself
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ 1, true ]

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/npm-debug.log

I found some stackoverflow notes regarding errors like "Refusing to install PACKAGE_NAME as a dependency of itself" and the answers suggested to rename the node package to something other than the library used. I tried that, setting "name" to "node-pocketsphinx" in package.json and seemed to move on without errors:

gp-mb:node-pocketsphinx georgeprofenza$ PKG_CONFIG_PATH=/usr/local/lib/pkg-config sudo npm install pocketsphinx --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   'pocketsphinx',
npm verb cli   '--verbose' ]
npm info using npm@3.3.12
npm info using node@v5.5.0
npm verb request uri https://registry.npmjs.org/pocketsphinx
npm verb request no auth needed
npm info attempt registry request try #1 at 8:24:45 PM
npm verb request id 186328d1dc066f7e
npm verb etag "51CF6L724Z4XBK0IE3JPO4CW9"
npm http request GET https://registry.npmjs.org/pocketsphinx
npm http 304 https://registry.npmjs.org/pocketsphinx
npm verb headers { date: 'Thu, 18 Feb 2016 20:24:45 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: '"51CF6L724Z4XBK0IE3JPO4CW9"',
npm verb headers   age: '14',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-lhr6321-LHR',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '1',
npm verb headers   'x-timer': 'S1455827085.519428,VS0,VE0',
npm verb headers   vary: 'Accept' }
npm verb etag https://registry.npmjs.org/pocketsphinx from cache
npm verb get saving pocketsphinx to /Users/georgeprofenza/.npm/registry.npmjs.org/pocketsphinx/.cache.json
npm verb cache add spec pocketsphinx
npm verb addNamed "*" is a valid semver range for pocketsphinx
npm verb addNameRange registry:https://registry.npmjs.org/pocketsphinx not in flight; fetching
npm verb get https://registry.npmjs.org/pocketsphinx not expired, no request
npm verb addNamed "5.0.5" is a plain semver version for pocketsphinx
npm verb afterAdd /Users/georgeprofenza/.npm/pocketsphinx/5.0.5/package/package.json not in flight; writing
npm verb afterAdd /Users/georgeprofenza/.npm/pocketsphinx/5.0.5/package/package.json written
npm verb lock using /Users/georgeprofenza/.npm/_locks/staging-18172aeb212e1ca1.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging
npm verb unbuild node_modules/.staging/pocketsphinx-2a9eecaa353424e832e2d4185465cd01
npm verb gentlyRm don't care about contents; nuking /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging/pocketsphinx-2a9eecaa353424e832e2d4185465cd01
npm verb tar unpack /Users/georgeprofenza/.npm/pocketsphinx/5.0.5/package.tgz
npm verb tar unpacking to /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging/pocketsphinx-2a9eecaa353424e832e2d4185465cd01
npm verb gentlyRm don't care about contents; nuking /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging/pocketsphinx-2a9eecaa353424e832e2d4185465cd01
npm info lifecycle pocketsphinx@5.0.5~preinstall: pocketsphinx@5.0.5
npm info linkStuff pocketsphinx@5.0.5
npm verb linkBins pocketsphinx@5.0.5
npm verb linkMans pocketsphinx@5.0.5
npm info lifecycle pocketsphinx@5.0.5~install: pocketsphinx@5.0.5
npm WARN lifecycle pocketsphinx@5.0.5~install: cannot run in wd %s %s (wd=%s) pocketsphinx@5.0.5 node-gyp rebuild /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/pocketsphinx
npm info lifecycle pocketsphinx@5.0.5~postinstall: pocketsphinx@5.0.5
npm verb unlock done using /Users/georgeprofenza/.npm/_locks/staging-18172aeb212e1ca1.lock for /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx/node_modules/.staging
node-pocketsphinx@5.0.5 /Users/georgeprofenza/Downloads/Libraries/c++/sphinx/github/node-pocketsphinx
└── pocketsphinx@5.0.5  extraneous

npm verb exit [ 0, true ]
npm info ok 

The issue is I can't see build/Release/PocketSphinx.node and build/Release/SphinxBase.node and I see a pocketsphinx module in node_modules, which looks like a copy of the main repo (without build files though).

I am getting more confused now. After following the common.gypi fix suggestion, things look ok on the surface:

ls ~/.node-gyp/5.5.0/
common.gypi deps        installVersion  src     tools

pkg-config --cflags --libs sphinxbase
-I/usr/local/include -I/usr/local/include/sphinxbase -L/usr/local/lib -lsphinxbase -lsphinxad -lpthread -lm -lblas -llapack 

How can I compile node-pocket sphinx with this setup ?

nshmyrev commented 8 years ago

I changed build from node-gyp to cmake-js, now better dependency checks and more straightforward compilation process. Check it out