n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

installation problem on Mac OS #123

Closed willwangcc closed 6 years ago

willwangcc commented 6 years ago

I can use my node globally, but I don't know why there a message about "node: command not found"

Below is what I do: `~ git:master ❯ sudo npm install -g ijavascript ✹ ✭

⸨ ░░░░░░░░░░░░░░░░░⸩ ⠦ fetchMetadata: sill resolveWithNewModule string_decoder@ /usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js /usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js /usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js /usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js /usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js

zeromq@4.6.0 install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

sh: node: command not found sh: node: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! zeromq@4.6.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the zeromq@4.6.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/wangzhixiang/.npm/_logs/2017-10-31T05_07_45_178Z-debug.log`

willwangcc commented 6 years ago

~ git:master ❯ open /Users/wangzhixiang/.npm/_logs/2017-10-31T05_07_45_178Z-debug.log

1519 verbose pkgid zeromq@4.6.0 1520 verbose cwd /Users/wangzhixiang 1521 verbose Darwin 16.7.0 1522 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ijavascript" 1523 verbose node v8.5.0 1524 verbose npm v5.5.1 1525 error file sh 1526 error code ELIFECYCLE 1527 error errno ENOENT 1528 error syscall spawn 1529 error zeromq@4.6.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) 1529 error spawn ENOENT 1530 error Failed at the zeromq@4.6.0 install script. 1530 error This is probably not a problem with npm. There is likely additional logging output above. 1531 verbose exit [ 1, true ]

n-riesco commented 6 years ago

The command sudo npm install -g ijavascript installs IJavascript globally (for all the users in your computer). This requires that node is also installed globally.

If you want to install IJavascript only for your user, see the instructions here.


To confirm that node isn't accessible by your root user, please, run the following command:

$ sudo which node || echo Not found
Not found
willwangcc commented 6 years ago

I tried the command and it showed that I can use node globally.

$ sudo which node || echo Not found                     
/usr/local/bin/node
$ ❯ sudo node                                                    
> console.log("Hello")
Hello
undefined
> 
willwangcc commented 6 years ago

Thanks, @n-riesco, It works. I think that it is not about 'node'. I do as http://n-riesco.github.io/ijavascript/doc/install.md.html#local-installation shows. I missed one command conda install nodejs.

Before: I did as Gihub Installation asked.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install pkg-config node zeromq
sudo easy_install pip
sudo pip install --upgrade pyzmq jupyter
sudo npm install -g ijavascript

After: I do as http://n-riesco.github.io/ijavascript/doc/install.md.html#local-installation shows.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install pkg-config node zeromq
sudo easy_install pip
sudo pip install --upgrade pyzmq jupyter
conda install nodejs  
sudo npm install -g ijavascript
n-riesco commented 6 years ago

@WillWang-X Oh... so you've installed Anaconda, haven't you?

I'm happy to hear it's working for you.

I'm going to reopen the issue to remind me to check the installation instructions for mac.

chrisVillanueva commented 6 years ago

I have the same issue as @WillWang-X . I'm on macHighSierra 10.13.1

I have nodejs and npm installed:

christophers-MacBook-Pro:~ christophervillanueva$ node --version v9.2.0 christophers-MacBook-Pro:~ christophervillanueva$ npm --version 5.5.1

All installation steps in the README work until the last command; christophers-MacBook-Pro:~ christophervillanueva$ sudo npm install -g ijavascript Password: /usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js /usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js /usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js /usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js /usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js

zeromq@4.6.0 install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

prebuild-install info begin Prebuild-install version 2.3.0 prebuild-install info looking for local prebuild @ prebuilds/zeromq-v4.6.0-node-v59-darwin-x64.tar.gz prebuild-install WARN install EACCES: permission denied, access '/Users/christophervillanueva/.npm'

fs.js:905 return binding.mkdir(pathModule.toNamespacedPath(path), ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq' at Object.fs.mkdirSync (fs.js:905:18) at Object. (/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/scripts/preinstall.js:89:8) at Module._compile (module.js:641:30) at Object.Module._extensions..js (module.js:652:10) at Module.load (module.js:560:32) at tryModuleLoad (module.js:503:12) at Function.Module._load (module.js:495:3) at Function.Module.runMain (module.js:682:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:613:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zeromq@4.6.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zeromq@4.6.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/christophervillanueva/.npm/_logs/2017-11-17T02_08_30_334Z-debug.log

Any suggestions?

n-riesco commented 6 years ago

@chrisVillanueva I've open a new issue to track your problem. See #124

n-riesco commented 6 years ago

Closing this issue since I've opened issue #126 to track any updates needed to the installation instructions on Mac.

adeelshahid commented 6 years ago

since #126 is closed as well, anyone ending up here. Just remove sudo from the above commands and it should fix the problem

pip install --upgrade pyzmq jupyter
npm install -g ijavascript
ilonabudapesti commented 5 years ago

This is still an issue on OS X High Sierra 10.13.6 today. I had node and npm available to all users but still got errors

gyp ERR! configure error
gyp ERR! stack Error: Command failed: /anaconda/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:381:11)
gyp ERR! stack     at Socket.emit (events.js:182:13)
gyp ERR! stack     at Pipe._handle.close (net.js:606:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/ijavascript/node_modules/zeromq
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zeromq@4.6.0 install script.

Running conda install nodejs fixed the issue. Then npm install -g ijavascript.

n-riesco commented 5 years ago

@ilonabudapesti Judging by the error message, it looks like you were affected by #165.