Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 78 forks source link

PATH in Nodeclipse different from system PATH #150

Closed hanxue closed 10 years ago

hanxue commented 10 years ago

I tried running npm install that requires node-gyp, and it failed

npm http GET https://registry.npmjs.org/scrypt
npm http 304 https://registry.npmjs.org/scrypt

> scrypt@3.0.1 install /Users/hanxue/Code/RTI/controlpanel/node_modules/scrypt
> node-gyp rebuild

execvp(): No such file or directory

When I launch the Terminal plugin, this is the value of $PATH

bash-3.2$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/Users/hanxue/Github/rvm/bin:/Users/hanxue/.rvm/bin

Contrast this with my default system PATH that has many more directories including /usr/local/bin where node-gyp is located

$ echo $PATH
/Users/hanxue/.jenv/shims:/Users/hanxue/bin:/Users/hanxue/.jenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/Cellar/play/2.2.0/bin:/usr/libexec:/Users/hanxue/.cabal/bin:/usr/local/share/python:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/hanxue/Github/depot_tools:/Users/hanxue/Source/google-cloud-sdk/bin
paulvi commented 10 years ago

Terminal plugin is not Nodeclipse project. And it does not work on Windows that I am using.

What exactly do you install? How to reproduce? This is issue now is like question, not bug report.

By default launch app in Eclipse (Node.js or Java) gets no environment variables. Developer can configure on Launch Configuration.
Nodeclipse also give options #124 "pass all environment variables of Eclipse to launched Node.js app" see http://www.nodeclipse.org/history (also #122)

Launch logic is at launch() https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationDelegate.java#L59 and getEnvironmentVariables() https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationDelegate.java#L247

read code and propose changes.

hanxue commented 10 years ago

Thanks @PaulVI for your quick response. Specifically I was trying to install the node-scrypt module.

Steps to reproduce

  1. Add dependencies -> "scrypt": "*" into package.json
  2. Right-click on package.json > Run As > npm install

Results in this error message

> scrypt@3.0.1 install /Users/hanxue/Code/RTI/controlpanel/node_modules/scrypt2
> node-gyp rebuild

execvp(): No such file or directory

Environment variable

The Node application launcher has environment settings

image

Not for npm install

image

paulvi commented 10 years ago

Why not just Ctrl+Alt+D npm install scrypt --save ? :)

What I got in Enide Studio and on Windows cmd: (that mean this issue of that library on Windows)

npm WARN package.json NodeProject1@0.1.0 No repository field.
npm http GET https://registry.npmjs.org/scrypt
npm http 304 https://registry.npmjs.org/scrypt
npm http GET https://registry.npmjs.org/scrypt/-/scrypt-3.0.1.tgz
npm http 200 https://registry.npmjs.org/scrypt/-/scrypt-3.0.1.tgz

> scrypt@3.0.1 install D:\Workspaces\Enide-Studio-2014-011-win64\NodeProject1\node_modules\scrypt
> node-gyp rebuild

D:\Workspaces\Enide-Studio-2014-011-win64\NodeProject1\node_modules\scrypt>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild 
gypnpm ERR! scrypt@3.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the scrypt@3.0.1 install script.
npm ERR! This is most likely a problem with the scrypt 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 scrypt
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd D:\Workspaces\Enide-Studio-2014-011-win64\NodeProject1
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm         

Find package GitHub repo and raise issue their to continue. There are quite a lot of Node packages that do not work [e.g. on Windows or generally]