romainberger / yeoman-flask

Yeoman generator for Flask project
MIT License
73 stars 13 forks source link

fall install script #2

Closed suenot closed 11 years ago

suenot commented 11 years ago
suenot@acer:~$ mkdir test2
suenot@acer:~$ cd test2
suenot@acer:~/test2$ sudo npm install -g yeoman-flask
npm http GET https://registry.npmjs.org/yeoman-flask
npm http 304 https://registry.npmjs.org/yeoman-flask
> yeoman-flask@0.2.1 install /usr/lib/node_modules/yeoman-flask
> python install.py
It seems that Yeoman is not installed.
If you have trouble installing the generator please refer to the install instructions in the Readme.
Traceback (most recent call last):
  File "install.py", line 15, in <module>
    os.exit()
AttributeError: 'module' object has no attribute 'exit'
npm ERR! yeoman-flask@0.2.1 install: `python install.py`
npm ERR! `sh "-c" "python install.py"` failed with 1
npm ERR! 
npm ERR! Failed at the yeoman-flask@0.2.1 install script.
npm ERR! This is most likely a problem with the yeoman-flask package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     python install.py
npm ERR! You can get their info via:
npm ERR!     npm owner ls yeoman-flask
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.5.0-19-generic
npm ERR! command "nodejs" "/usr/bin/npm" "install" "-g" "yeoman-flask"
npm ERR! cwd /home/suenot/test2
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/suenot/test2/npm-debug.log
npm ERR! not ok code 0
suenot@acer:~/test2$ 
suenot commented 11 years ago

Hm,,, I don't have node_modules folder, but have node.

suenot@acer:/usr/local/lib$ cd node_modules
bash: cd: node_modules: No such file or directory
suenot@acer:/usr/local/lib$ cd ~
suenot@acer:~$ yeoman
yeoman v0.9.6
Usage: yeoman [command] [task [task ...]]
Available commands supported by yeoman:
      init  Initialize and scaffold a new project using generator templates
     build  Build an optimized version of your app, ready to deploy
    server  Launch a preview server which will begin watching for changes
      test  Run a Mocha test harness in a headless PhantomJS
   install  Install a package from the clientside package registry
 uninstall  Uninstall the package
    update  Update a package to the latest version
      list  List the packages currently installed
    search  Query the registry for matching package names
    lookup  Look up info on a particular package
Certain commands such as init also provide further help via a --help flag
suenot@acer:~$ npm
Usage: npm <command>
where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, la, link, list, ll,
    ln, login, ls, outdated, owner, pack, prefix, prune,
    publish, r, rb, rebuild, remove, restart, rm, root,
    run-script, s, se, search, set, show, shrinkwrap, star,
    start, stop, submodule, tag, test, tst, un, uninstall,
    unlink, unpublish, unstar, up, update, version, view,
    whoami
npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview
Specify configs in the ini-formatted file:
    /home/suenot/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@1.1.69 /usr/lib/nodejs/npm
suenot@acer:~$ 
suenot commented 11 years ago

cd /usr/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators Without /local dir in path in my case. Xubuntu 12.10.

romainberger commented 11 years ago

Without /local dir in path in my case

Did you try cloning the repo in /usr/lib/node_modules/yeoman/node_modules/yeoman-generators/lib/generators then? It should work.

Xubuntu 12.10. I made the install script based on Mac os, and never tested it on other platform. I should add a warning about that in the readme.

suenot commented 11 years ago

Yeoman server working. But doesn't working ./server

suenot@acer:~/Dropbox/sites$ python server.py
File "server.py", line 2
from yeoman-flask import yeoman-flask
^
SyntaxError: invalid syntax

I didn't set virtualenv in this folder, probably my problem now in this.

romainberger commented 11 years ago

from yeoman-flask import yeoman-flask

The problem is the name you gave to your app. Try to use a name without hyphens (basically, following the python module name convention).

suenot commented 11 years ago

Set virtualenv in /Dropbox/sites/yf/, create app in /Dropbox/sites/yf/app/. But...

(yf)suenot@acer:~/Dropbox/sites/yf$ ls
app  bin  freeze.py  Gruntfile.js  include  lib  local  server.py
(yf)suenot@acer:~/Dropbox/sites/yf$ python server.py 
Traceback (most recent call last):
  File "server.py", line 2, in <module>
    from app import app
  File "/home/suenot/Dropbox/sites/yf/app/__init__.py", line 1, in <module>
    from flask import Flask, url_for
ImportError: No module named flask
(yf)suenot@acer:~/Dropbox/sites/yf$ sudo pip install flask
Requirement already satisfied (use --upgrade to upgrade): flask in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from flask)
Cleaning up...
romainberger commented 11 years ago

So is this working now that you installed Flask?

suenot commented 11 years ago

Flask already installed. But print:

ImportError: No module named flask
romainberger commented 11 years ago

If you have this error this is clearly because of the Flask installation. As you told me that you've set up a virtual env, you need to be sure that you installed Flask in this environment, and that you activate the environment when you try to run the python server.

I am closing this issue as it does not have something to do with the yeoman-flask generator. Maybe try posting on stackoverflow if you have problems with your virtual env / module installation.