2016-04-23 13 views
0

ich diesen tutorial bin mit Express zu installieren, so wurde ausgeführt:express nicht found` -bash: express: Befehl found` nicht

$ sudo npm install -g express

es erfolgreich bestanden:

Password: 
[email protected] /usr/local/lib/node_modules/express 
├── [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]) 
├── [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] 

aber wenn ich versuche, wie das Tutorial zu laufen, sagt:

$ express donuts

ich:

-bash: express: command not found

ich etwas fehle?

+0

Express erscheint nicht in der Variablen '$ PATH'. Exportieren Sie den Speicherort mit 'export PATH = $ PATH:/path/to/express /' in den Pfad 'PATH' – selyunin

Antwort

1

Um ein Express-Anwendungsskelett zu erstellen, bietet Express ein Befehlszeilentool (express-generator: Anwendung Generator-Tool) und mit diesem können Sie eine Anwendung Skelett schnell erstellen.

Installieren express-generator mit dem folgenden Befehl:

$ sudo npm install express-generator -g 

Und nach einer erfolgreichen Installation Prüfung installierte Version mit folgendem Befehl:

$ express -V 

Um die verfügbaren Befehlsoptionen verwenden, um die Option -h zu sehen:

$ express --help 

    Usage: express [options] [dir] 

    Options: 

    -h, --help   output usage information 
    -V, --version  output the version number 
    -e, --ejs   add ejs engine support (defaults to jade) 
     --hbs   add handlebars engine support 
    -H, --hogan   add hogan.js engine support 
    -c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css) 
     --git   add .gitignore 
    -f, --force   force on non-empty directory 

Und das folgende erstellt ein E xpress App namens myapp im aktuellen Arbeitsverzeichnis:

$ express myapp 

    create : myapp 
    create : myapp/package.json 
    create : myapp/app.js 
    create : myapp/public 
    create : myapp/public/javascripts 
    create : myapp/public/images 
    create : myapp/routes 
    create : myapp/routes/index.js 
    create : myapp/routes/users.js 
    create : myapp/public/stylesheets 
    create : myapp/public/stylesheets/style.css 
    create : myapp/views 
    create : myapp/views/index.jade 
    create : myapp/views/layout.jade 
    create : myapp/views/error.jade 
    create : myapp/bin 
    create : myapp/bin/www 

installieren Abhängigkeiten den folgenden Befehl ausführen:

$ npm install 

In Ihrem Fall, dass Sie die Express-Framework installiert haben, nicht global Anwendungsgenerator ausdrücken Werkzeug.

Weitere Referenz finden Sie in der folgenden Link - http://expressjs.com/en/starter/generator.html

Hoffnung das wird Ihnen helfen !!