2017-01-17 2 views
0

Letzte Woche habe ich ein wirklich einfaches Paket auf NPM veröffentlicht. Es besteht aus nur drei Dateien:`npm publish` und dann` npm install` stellt das veröffentlichte Paket nicht wieder her

package.json README.md tofjs-full.node.js 

Die tofjs-full.node.js enthalten den gesamten Code, das Paket tofjs-full genannt wird und es soll nach einem require('tofjs-full') Anruf zur Verfügung steht.

Die package.json Datei hat folgenden Inhalt:

{ "name": "tofjs-full", 
    "version": "1.0.0", 
    "description": "`tofjs-full` is the current state of the [TofJs](http://tofjs.org) program, bundled in a single NPM package.", 
    "author": "bucephalus <[email protected]> (http://bucephalus.org)", 
    "license": "ISC", 
    "homepage": "http://tofjs.org/program/tofjs-full", 
    "bugs": { "url": "https://groups.google.com/forum/#!forum/tofjs" }, 
    "repository": "http://tofjs.org/package/tofjs-full/1.0.0/", 
    "main": "tofjs-full.node.js", 
    "dependencies": { 
    "fs-extra": "^0.30.0", 
    "markdown": "^0.5.0", 
    "sha1": "^1.1.1", 
    "sha1-file": "^1.0.0", 
    "coffee-script": "^1.10.0", 
    "escodegen": "^1.8.0", 
    "esprima": "^2.7.2" 
    }, 
    "files": [ "tofjs-full.node.js" ] } 

ich das Paket veröffentlicht durch auf das entsprechende Verzeichnis zu gehen und

npm publish 

nenne ich nicht die genaue Reaktion erinnern. Aber das Paket tofjs-full ist jetzt offiziell vom NPM-Repository verfügbar (https://www.npmjs.com/package/tofjs-full).

Allerdings, wenn ich zu einer anderen Maschine gehen und versuchen, ein sudo npm installieren tofjs voll die Antwort ist eine Anzeige mit dem Baum aller Abhängigkeiten und dann einigen Warnungen (jede Zeile mit npm WARN beginnend):

ENOENT: no such file or directory, open `'/path/to/dir/package.json' 
No description field. 
No README data. 
No license field. 

Können Sie mir bitte sagen, was schief läuft? Danke, Bukephalos

+0

... Entschuldigung, ich wollte sagen "Das Paket' tofjs-full' ist jetzt offiziell vom NPM-Repository erhältlich. " statt "... nicht offiziell verfügbar ...". – user2527816

Antwort

1

Es ist nur eine Warnung, da es nicht die package.json für Ihr Projekt finden, da ich wie ich nehme an, Sie ging einfach in ein Verzeichnis und lief npm install tofjs-full. Es kann sicher ignoriert werden.

npm install tofjs-full 
- [email protected] node_modules/node_modules/node_modules/rxjs 
- [email protected] node_modules/node_modules/node_modules/zone.js 
/path/dir 
├── UNMET PEER DEPENDENCY @angular/[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]1.0.1 
    ├── [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] 

npm WARN enoent ENOENT: no such file or directory, open '/path/dir/package.json' 
npm WARN enoent ENOENT: no such file or directory, open '/path/dir/node_modules/node_modules/package.json' 
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. 
npm WARN xxxx No description 
npm WARN xxxx No repository field. 
npm WARN xxxx No README data 
npm WARN xxxx No license field. 

Sie sollten feststellen, dass die Bibliothek bei /path/dir/node_modules/tofjs-full

+0

Ahhh, du bist großartig! Vielen Dank für Ihre Antwort, ich bin sehr dankbar. Aber das Problem ist, dass das Paket nicht installiert wird. Es zeigt sich tatsächlich nach einem 'npm ls'. Aber wenn ich eine 'node' Sitzung starte und' require ('tofjs-full') '' anrufe, heißt es 'Error: Modul 'tofjs-full' kann nicht gefunden werden. – user2527816

+0

@ user2527816 Blick auf den Inhalt Ihres Pakets Ich sehe nur die folgenden 'README.md & package.json'. Es scheint, als ob du die npm-Veröffentlichung gemacht hast, die nicht richtig gemacht wurde oder mit den richtigen Dateien und/oder der Konfiguration. – Kody

+0

@ user2527816 Ich denke, es könnte mit Ihrer '" repository ":" http://tofjs.org/package/tofjs-full/1.0.0/ "Konfiguration zusammenhängen. Es scheint, dass dies kein gültiges Repository ist. – Kody

0

installiert wurde ich ein Paket mit drei Dateien veröffentlicht, aber eine der Dateien ein Soft-Link auf die Originaldatei war. Es scheint, dass npm publish weiche Links ignoriert, weil ein nachfolgender npm install nicht über die Datei wusste. Ich löste das Problem durch einen anderen Patch, wo ich den Softlink durch eine richtige Datei ersetzte. Danke Kody und baao, du hast mir wirklich den Tag versüßt, indem du mir geholfen hast! :-)