Install JSBin locally

1.9k views Asked by At

I wanted to follow this page to run JSBin locally.

I have installed xcode 8.2 in my mac. Now, npm -v returns 3.10.9; node -v returns v7.2.1.

After git clone [email protected]:remy/jsbin.git and cd jsbin, I modified package.json such that it has "memcached": "2.2.2" inside (see this thread), then npm install returns

/Users/softtimur/Startup/WebProjects/tmp/jsbin$ npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: Use `setimmediate` instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g

> [email protected] install /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! UNCAUGHT EXCEPTION 
node-pre-gyp ERR! stack Error: Cannot find module 'internal/fs'
node-pre-gyp ERR! stack     at Function.Module._resolveFilename (module.js:470:15)
node-pre-gyp ERR! stack     at Function.Module._load (module.js:418:25)
node-pre-gyp ERR! stack     at Module.require (module.js:498:17)
node-pre-gyp ERR! stack     at require (internal/module.js:20:19)
node-pre-gyp ERR! stack     at evalmachine.<anonymous>:17:20
node-pre-gyp ERR! stack     at Object.<anonymous> (/Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar/node_modules/fstream/node_modules/graceful-fs/fs.js:11:8)
node-pre-gyp ERR! stack     at Module._compile (module.js:571:32)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (module.js:580:10)
node-pre-gyp ERR! stack     at Module.load (module.js:488:32)
node-pre-gyp ERR! stack     at tryModuleLoad (module.js:447:12)
node-pre-gyp ERR! System Darwin 16.3.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/7.2.1/bin/node" "/Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3
node-pre-gyp ERR! node -v v7.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.5.22
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR!     <https://github.com/mapbox/node-pre-gyp/issues>
[email protected] /Users/softtimur/Startup/WebProjects/tmp/jsbin
├── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   └── [email protected] 
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
├── UNMET PEER DEPENDENCY casperjs@>= 1.1.0-beta3 
......
......
......
npm WARN [email protected] requires a peer of casperjs@>= 1.1.0-beta3 but none was installed.
npm WARN In [email protected] replacing bundled version of readable-stream with [email protected]
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/softtimur/Startup/WebProjects/tmp/jsbin/npm-debug.log

Does anyone know what's wrong here?

Edit 1: If I put "memcached": "2.2.2" and "sqlite3": "3.1.8" in package.json, npm install returns:

/Users/softtimur/Startup/WebProjects/tmp/jsbin$ npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Use `setimmediate` instead
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN prefer global [email protected] should be installed with -g
npm WARN prefer global [email protected] should be installed with -g

> [email protected] install /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/sqlite3/lib/binding/node-v51-darwin-x64/node_sqlite3.node" is installed via remote

> [email protected] install /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/zmq
> node-gyp rebuild

Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
gyp: Call to 'pkg-config libzmq --libs' returned exit status 1 while in 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/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.3.0
gyp ERR! command "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/zmq
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

> [email protected] postinstall /Users/softtimur/Startup/WebProjects/tmp/jsbin
> grunt build && npm run selenium:install

Running "concat:dist" (concat) task
File "public/js/prod/jsbin-3.40.2.js" created.

Running "concat:runner" (concat) task
File "public/js/prod/runner-3.40.2.js" created.

Running "uglify:dist" (uglify) task
File "public/js/prod/jsbin-3.40.2.min.js" created.

Running "uglify:runner" (uglify) task
File "public/js/prod/runner-3.40.2.min.js" created.

Running "uglify:embed" (uglify) task
File "public/js/embed.min.js" created.

Running "uglify:addons" (uglify) task
File "public/js/prod/addon-tern-3.40.2.min.js" created.

Done, without errors.

> [email protected] selenium:install /Users/softtimur/Startup/WebProjects/tmp/jsbin
> selenium-standalone install

----------
selenium-standalone installation starting
----------

---
selenium install:
from: https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar
to: /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/selenium-standalone/.selenium/selenium-server/2.53.1-server.jar
---
chrome install:
from: https://chromedriver.storage.googleapis.com/2.25/chromedriver_mac64.zip
to: /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/selenium-standalone/.selenium/chromedriver/2.25-x64-chromedriver
---
firefox install:
from: https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-macos.tar.gz
to: /Users/softtimur/Startup/WebProjects/tmp/jsbin/node_modules/selenium-standalone/.selenium/geckodriver/0.11.1-x64-geckodriver


selenium-standalone installation [=========           ] 43% 5.7s

-----
selenium-standalone installation finished
-----

> [email protected] prepublish /Users/softtimur/Startup/WebProjects/tmp/jsbin
> npm run snyk-protect


> [email protected] snyk-protect /Users/softtimur/Startup/WebProjects/tmp/jsbin
> snyk protect

Successfully applied Snyk patches
[email protected] /Users/softtimur/Startup/WebProjects/tmp/jsbin
├── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   └── [email protected] 
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
├── UNMET PEER DEPENDENCY casperjs@>= 1.1.0-beta3
......
......
......
npm WARN [email protected] requires a peer of casperjs@>= 1.1.0-beta3 but none was installed.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/zmq):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

And npm start returns:

/Users/softtimur/Startup/WebProjects/tmp/jsbin$ npm start

> [email protected] start /Users/softtimur/Startup/WebProjects/tmp/jsbin
> (sleep 2 && open http://localhost:3000) & ./bin/jsbin

Config from /Users/softtimur/Startup/WebProjects/tmp/jsbin/lib/config.local.json
module.js:472
    throw err;
    ^

Error: Cannot find module 'express/node_modules/connect'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/softtimur/Startup/WebProjects/tmp/jsbin/lib/middleware.js:4:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `(sleep 2 && open http://localhost:3000) & ./bin/jsbin`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script '(sleep 2 && open http://localhost:3000) & ./bin/jsbin'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the jsbin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     (sleep 2 && open http://localhost:3000) & ./bin/jsbin
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs jsbin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls jsbin
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/softtimur*emphasized text*/Startup/WebProjects/tmp/jsbin/npm-debug.log

Edit 2:

Following mscdex's comment, the following actions solved libzmq error:

  1. install zmq using brew : brew install zmq
  2. export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.2.0/lib/pkgconfig/
  3. sudo visudo and add Defaults env_keep += "PKG_CONFIG_PATH"
  4. set zmq to 2.15.3 in package.json

The express/node_modules/connect was hard-coded in lib/middleware.js. I changed express/node_modules/connect to connect, it finally works.

1

There are 1 answers

1
mscdex On BEST ANSWER

Most likely sqlite3 needs to be upgraded to the most recent version which has a newer node-pre-gyp dependency, which in turn should have its own updated dependencies to work properly with modern versions of node.

The libzmq errors are occurring because you don't have the appropriate libzmq packages installed to be able to build against.

The Error: Cannot find module 'express/node_modules/connect' message is most likely due to npm v3 changing how modules can be stored (to reduce deep nesting). It appears that jsbin is making an assumption about where express's dependencies are located by hardcoding a path instead of using proper module resolution.