使用npm,您可以声明一个带有URL的依赖项,该URL指向包含节点模块的gzip压缩包。我通过在OSX终端中运行tar命令来实现这一点。但我宁愿使用git archive,以便输出不包含.git内容和repo忽略的东西(node_modules)。
我像这样创建档案:
git archive master | gzip> ../ archive.tar.gz
但是当我尝试使用npm(npm install archive.tar.gz或将其放在package.json中)安装它时,它失败并出现此错误:
npm ERR! couldn't unpack /var/folders/gc/6rgb6g4x0n96nc1scbvv87040000gn/T/npm-1329949280846/1329949280846-0.19062370574101806/tmp.tgz to /var/folders/gc/6rgb6g4x0n96nc1scbvv87040000gn/T/npm-1329949280846/1329949280846-0.19062370574101806
npm ERR! Could not install: /javascript/archive.tar.gz
npm ERR! Error: ENOTDIR, not a directory '/var/folders/gc/6rgb6g4x0n96nc1scbvv87040000gn/T/npm-1329949280846/1329949280846-0.19062370574101806/package/package.json'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "/javascript/archive.tar.gz"
npm ERR! cwd /Users/dave
npm ERR! node -v v0.6.11
npm ERR! npm -v 1.1.0-beta-10
npm ERR! path /var/folders/gc/6rgb6g4x0n96nc1scbvv87040000gn/T/npm-1329949280846/1329949280846-0.19062370574101806/package/package.json
npm ERR! code ENOTDIR
npm ERR! message ENOTDIR, not a directory '/var/folders/gc/6rgb6g4x0n96nc1scbvv87040000gn/T/npm-1329949280846/1329949280846-0.19062370574101806/package/package.json'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/dave/npm-debug.log
知道git存档和常规tar之间会有什么不同,这会导致npm安装失败吗?
答案 0 :(得分:0)
虽然存档的格式可能在此问题中起作用(如注释中提及Borealid),但我还要仔细检查这是否与参数{{1中的长度问题无关“必须处理。
5个月之前使用此issue on npm(适用于Windows,但如果路径确实长,仍可能对您的环境产生影响),请参阅此fix proposed。< / p>
另请参阅issue 1951: "Can't unpack with tar (on Mac)",其中npm
的版本与tar
不兼容(如同issue 1511一样,也适用于Mac)。