Install JSBin locally

岁酱吖の 提交于 2019-12-10 23:45:54

问题


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 git@github.com: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 jade@1.4.2: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@2.0.3: 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 transformers@2.1.0: Deprecated, use jstransformer
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN deprecated set-immediate@0.1.1: Use `setimmediate` instead
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: 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 minimatch@0.0.5: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN prefer global js-beautify@1.5.4 should be installed with -g
npm WARN prefer global jshint@0.9.1 should be installed with -g

> sqlite3@2.2.7 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>
jsbin@3.40.2 /Users/softtimur/Startup/WebProjects/tmp/jsbin
├── async@0.1.22 
├── asyncjs@0.0.7 
├─┬ aws-sdk@2.7.17 
│ ├─┬ buffer@4.9.1 
│ │ ├── base64-js@1.2.0 
│ │ ├── ieee754@1.1.8 
│ │ └── isarray@1.0.0 
│ ├── crypto-browserify@1.0.9 
│ ├── jmespath@0.15.0 
│ ├── querystring@0.2.0 
│ ├── sax@1.1.5 
│ ├─┬ url@0.10.3 
│ │ └── punycode@1.3.2 
│ ├── uuid@3.0.0 
│ ├── xml2js@0.4.15 
│ └─┬ xmlbuilder@2.6.2 
│   └── lodash@3.5.0 
├─┬ axon@2.0.3 
│ ├── amp@0.3.1 
│ ├── amp-message@0.1.2 
│ ├── configurable@0.0.1 
│ └── escape-regexp@0.0.1 
├── bcrypt-nodejs@0.0.3 
├── bin-to-file@0.0.5 
├── UNMET PEER DEPENDENCY casperjs@>= 1.1.0-beta3 
......
......
......
npm WARN mocha-casperjs@0.5.8 requires a peer of casperjs@>= 1.1.0-beta3 but none was installed.
npm WARN In sqlite3@2.2.7 replacing bundled version of readable-stream with readable-stream@1.0.34
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! sqlite3@2.2.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the sqlite3@2.2.7 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 jade@1.4.2: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: 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 minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated set-immediate@0.1.1: Use `setimmediate` instead
npm WARN deprecated graceful-fs@1.2.3: 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 minimatch@0.0.5: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN prefer global js-beautify@1.5.4 should be installed with -g
npm WARN prefer global jshint@0.9.1 should be installed with -g

> sqlite3@3.1.8 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

> zmq@2.6.0 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 

> jsbin@3.40.2 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.

> jsbin@3.40.2 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
-----

> jsbin@3.40.2 prepublish /Users/softtimur/Startup/WebProjects/tmp/jsbin
> npm run snyk-protect


> jsbin@3.40.2 snyk-protect /Users/softtimur/Startup/WebProjects/tmp/jsbin
> snyk protect

Successfully applied Snyk patches
jsbin@3.40.2 /Users/softtimur/Startup/WebProjects/tmp/jsbin
├── async@0.1.22 
├── asyncjs@0.0.7 
├─┬ aws-sdk@2.7.17 
│ ├─┬ buffer@4.9.1 
│ │ ├── base64-js@1.2.0 
│ │ ├── ieee754@1.1.8 
│ │ └── isarray@1.0.0 
│ ├── crypto-browserify@1.0.9 
│ ├── jmespath@0.15.0 
│ ├── querystring@0.2.0 
│ ├── sax@1.1.5 
│ ├─┬ url@0.10.3 
│ │ └── punycode@1.3.2 
│ ├── uuid@3.0.0 
│ ├── xml2js@0.4.15 
│ └─┬ xmlbuilder@2.6.2 
│   └── lodash@3.5.0 
├─┬ axon@2.0.3 
│ ├── amp@0.3.1 
│ ├── amp-message@0.1.2 
│ ├── configurable@0.0.1 
│ └── escape-regexp@0.0.1 
├── bcrypt-nodejs@0.0.3 
├── bin-to-file@0.0.5 
├── UNMET PEER DEPENDENCY casperjs@>= 1.1.0-beta3
......
......
......
npm WARN mocha-casperjs@0.5.8 requires a peer of casperjs@>= 1.1.0-beta3 but none was installed.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: zmq@2.6.0 (node_modules/zmq):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: zmq@2.6.0 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

> jsbin@3.40.2 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! jsbin@3.40.2 start: `(sleep 2 && open http://localhost:3000) & ./bin/jsbin`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the jsbin@3.40.2 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:


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.



来源:https://stackoverflow.com/questions/41254302/install-jsbin-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!