danielgtaylor / ladon

A small, simple cross-platform utility to process many files in parallel.
82 stars 6 forks source link

Install ladon offline #6

Closed cpu82 closed 8 years ago

cpu82 commented 8 years ago

Hi Daniel,

Currently we have a kernel bug on FreeBSD [0] which avoids to install properly all ports which depend on npm.

Is there anyway to install ladon and all its dependencies offline? I mean fetch all dependencies included in package.json (something like offline-npm). .. Carlos J

[0] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=178881

cpu82 commented 8 years ago

Trying to pack ladon to install it later offline (using offline-npm utility)

% npm pack

> ladon@1.0.6 prepublish /usr/home/cjpm/Desktop/ladon-1.0.6
> ./offline/offline-npm --prepublish ; node_modules/mocha/bin/_mocha -R spec test.js

async@0.9.2 node_modules/async

yargs@1.3.3 node_modules/yargs

mkdirp@0.5.1 node_modules/mkdirp
└── minimist@0.0.8

glob@4.0.6 node_modules/glob
├── inherits@2.0.1
├── graceful-fs@3.0.8
├── once@1.3.2 (wrappy@1.0.1)
└── minimatch@1.0.0 (sigmund@1.0.1, lru-cache@2.6.5)
npm WARN shrinkwrap Excluding devDependency: mocha { async: '~0.9.0',
npm WARN shrinkwrap   glob: '~4.0.5',
npm WARN shrinkwrap   mkdirp: '^0.5.0',
npm WARN shrinkwrap   yargs: '^1.2.1' }
wrote npm-shrinkwrap.json
node_modules/mocha/bin/_mocha: not found

npm ERR! addLocalDirectory Could not pack /usr/home/cjpm/Desktop/ladon-1.0.6 to /home/cjpm/.npm/ladon/1.0.6/package.tgz
npm ERR! addLocal Could not install /usr/home/cjpm/Desktop/ladon-1.0.6
npm ERR! FreeBSD 10.2-RELEASE
npm ERR! argv "node" "/usr/local/bin/npm" "pack"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! ladon@1.0.6 prepublish: `./offline/offline-npm --prepublish ; node_modules/mocha/bin/_mocha -R spec test.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the ladon@1.0.6 prepublish script './offline/offline-npm --prepublish ; node_modules/mocha/bin/_mocha -R spec test.js'.
npm ERR! This is most likely a problem with the ladon package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./offline/offline-npm --prepublish ; node_modules/mocha/bin/_mocha -R spec test.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls ladon
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/home/cjpm/Desktop/ladon-1.0.6/npm-debug.log

I noticed that if I remove mocha dependency from package.json it packages fine.

--- package.json.orig   2015-08-18 01:06:28.089238000 +0200
+++ package.json    2015-08-18 01:06:46.510897000 +0200
@@ -6,10 +6,6 @@
   "bin": {
     "ladon": "ladon.js"
   },
-  "scripts": {
-    "test": "node_modules/mocha/bin/_mocha -R spec test.js",
-    "prepublish": "node_modules/mocha/bin/_mocha -R spec test.js"
-  },
   "author": "Daniel G. Taylor",
   "license": "MIT",
   "dependencies": {
@@ -18,9 +14,6 @@
     "mkdirp": "^0.5.0",
     "yargs": "^1.2.1"
   },
-  "devDependencies": {
-    "mocha": "^1.18.2"
-  },
   "repository": {
     "type": "git",
     "url": "https://github.com/danielgtaylor/ladon.git"

Could you take a look?

danielgtaylor commented 8 years ago

@cpu82 you should be able to do an installation of Ladon, then zip up the entire folder (including node_modules and all). Then deploy that to another machine. I've never used any offline npm stuff, so I'm not sure I can provide any help there.

cpu82 commented 8 years ago

Hi @danielgtaylor,

It seems that mocha is excluded, but adding it to dependencies then it works

% npm pack

> ladon@1.0.6 prepublish /usr/home/cjpm/Desktop/ladon-master
> ./offline/offline-npm --prepublish ; node_modules/mocha/bin/_mocha -R spec test.js

async@0.9.2 node_modules/async

yargs@1.3.3 node_modules/yargs

mkdirp@0.5.1 node_modules/mkdirp
└── minimist@0.0.8

glob@4.0.6 node_modules/glob
├── inherits@2.0.1
├── graceful-fs@3.0.8
├── once@1.3.2 (wrappy@1.0.1)
└── minimatch@1.0.0 (sigmund@1.0.1, lru-cache@2.6.5)

mocha@1.21.5 node_modules/mocha
├── escape-string-regexp@1.0.2
├── diff@1.0.8
├── growl@1.8.1
├── commander@2.3.0
├── mkdirp@0.5.0 (minimist@0.0.8)
├── jade@0.26.3 (commander@0.6.1, mkdirp@0.3.0)
├── debug@2.0.0 (ms@0.6.2)
└── glob@3.2.3 (inherits@2.0.1, graceful-fs@2.0.3, minimatch@0.2.14)
wrote npm-shrinkwrap.json
\

  ladon
    ✓ Should provide a parser 
    ✓ Should quote a string 
    ✓ Should render a template with variables 
    ✓ Should return a help string 
    ✓ Should require at least a glob and command 
    ✓ Should run commands 

  6 passing (22ms)

ladon-1.0.6.tgz
cpu82 commented 8 years ago

The following patch fixes my problem. npm shrinkwrap doesn't exclude mocha if it's included in dependencies list.

% diff -urN package.json.orig package.json
--- package.json.orig   2015-08-18 11:25:08.659444000 +0200
+++ package.json    2015-08-18 11:25:44.827459000 +0200
@@ -16,12 +16,10 @@
     "async": "~0.9.0",
     "glob": "~4.0.5",
     "mkdirp": "^0.5.0",
+    "mocha": "^1.18.2",
     "yargs": "^1.2.1"
   },
-  "devDependencies": {
-    "mocha": "^1.18.2"
-  },
-  "repository": {
+   "repository": {
     "type": "git",
     "url": "https://github.com/danielgtaylor/ladon.git"
   },