Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Keeps Having Issues Finding My Node Path

Here's an example for me trying to install Node-Proxy because NowJS needs it:

sudo npm install node-proxy

    > [email protected] install /home/jennifer/node_modules/node-proxy
    > make

    BUILDING: C++ Component
    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.034s)
    Waf: Entering directory `/home/jennifer/node_modules/node-proxy/src/build'
    no such environment: default
    Traceback (most recent call last):
      File "/usr/local/bin/node-waf", line 16, in <module>
        Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
        prepare_impl(t, cwd, ver, wafdir)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
        main()
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
        fun(ctx)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
        return build_impl(bld)
      File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 399, in build_impl
        bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]])
      File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 981, in add_subdirs
        self.recurse(dirs, 'build')
      File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse
        f(self)
      File "/home/jennifer/node_modules/node-proxy/src/wscript", line 13, in build
        obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
      File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 335, in new_task_gen
        ret = cls(*k, **kw)
      File "/usr/local/bin/../lib/node/wafadmin/Tools/ccroot.py", line 162, in __init__
        TaskGen.task_gen.__init__(self, *k, **kw)
      File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 118, in __init__
        self.env = self.bld.env.copy()
    AttributeError: 'NoneType' object has no attribute 'copy'
    cp: cannot stat `src/build/*/node-proxy.node': No such file or directory
    make: *** [all] Error 1
    npm ERR! error installing [email protected] Error: [email protected] install: `make`
    npm ERR! error installing [email protected] `sh "-c" "make"` failed with 2
    npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/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] install: `make`
    npm ERR! `sh "-c" "make"` failed with 2
    npm ERR! 
    npm ERR! Failed at the [email protected] install script.
    npm ERR! This is most likely a problem with the node-proxy package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     make
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls node-proxy
    npm ERR! There is likely additional logging output above.
    npm ERR! 
    npm ERR! System Linux 2.6.38-11-generic
    npm ERR! command "node" "/usr/local/bin/npm" "install" "node-proxy"
    npm ERR! cwd /home/jennifer/node_modules
    npm ERR! node -v v0.4.11
    npm ERR! npm -v 1.0.30
    npm ERR! 
    npm ERR! Additional logging details can be found in:
    npm ERR!     /home/jennifer/node_modules/npm-debug.log
    npm not ok
like image 983
user784756 Avatar asked Sep 22 '11 12:09

user784756


People also ask

How do I find the npm path?

Try this: npm config get prefix will return the path.

Why my npm is not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

Can not find module node path?

To solve the "Cannot find module path or its corresponding type declarations" error, install the types for node by running the command npm i -D @types/node . You can then import path with the following line of code import * as path from 'path' .


2 Answers

Seems like this issue has also been reported here: https://github.com/joyent/node/issues/1716

The solution is here: http://permalink.gmane.org/gmane.comp.lang.javascript.nodejs/29563

like image 171
Eric Zhang Avatar answered Sep 24 '22 00:09

Eric Zhang


I got this when trying to downgrade from node v0.6x to v0.4x. Fix was to run sudo make uninstall in the v0.6x directory and then reinstall v0.4x.

like image 26
Garret Heaton Avatar answered Sep 26 '22 00:09

Garret Heaton