Famous/framework

Problem with setting up

law-liet opened this issue · 23 comments

I am using a OS X 10.10. I followed the steps in README, but it did not work. Nothing shows up in the browser. Here's the info after running npm run dev.

famous Building module lawliet:hello-world
famous Freezing dependencies for lawliet:hello-world...
famous    famous:core:node ~> HEAD
famous Let's try to bootstrap famous:core:node ~> HEAD locally...
Got error when trying to load dependencies: [Error: Failed to build dependencies locally for `famous:core:node` (HEAD)]
Unable to load `lawliet:hello-world`'s dependencies {"famous:core:node":"HEAD"}
famous ok Built bundle lawliet:hello-world ~> HEAD
famous    Bundle URL: http://localhost:1618/v1/blocks/lawliet:hello-world/versions/HEAD/assets/~bundles/bundle.js
Wrote 1041459 bytes to public/famous-framework.development.bundle.js

@law-liet Thanks for the report!

Can you start with a clean directory and try going through the setup instructions one more time? https://github.com/famous/framework#setup--installation We pushed a few fixes and improvements to this process yesterday that may have resolved the issue you're seeing.

If you still get the same issue, would you be able to post the exact commands that you ran so we can take a close look?

Also -- it might be helpful if we could see the contents of your components/ folder. You can dump all of the contents of that folder with a command like this:

find components -type f -exec cat {} \;

And copy and paste that output into a Gist.

I started a clean directory. I uninstalled and reinstalled famous-cli and followed the steps again.
Here's what I ran after entering a new directory:

sudo npm uninstall -g famous-cli
sudo npm install -g famous-cli
famous framework-scaffold

Then, I got:

Famous No user session detected.

OK, thanks @law-liet ! There is a missing piece to the install that we overlooked. Can you try running famous register to reserve a username for yourself, and then run famous framework-scaffold in another clean directory?

@wgester - Would it be possible to add a step to the Famous CLI that will first register a user, or create a session, if one does not already exist when the user attempts to run framework-scaffold?

Otherwise we can add a note to the README that indicates that they should run famous register to create a username, etc., before proceeding with the framework scaffold step.

Now, I ran famous register and changed to a new directory. Then I ran:

sudo famous framwork-scafforld
sudo npm run dev

I still got the same message in my first post and nothing in the browser.
Here's what I got by running find components/ -type f -exec cat {} \;:

{
    "dependencies": {}
}FamousFramework.scene('LawLiet:hello-world', {
    behaviors: {
        '#surface': {
            'content': '<h1>Hello LawLiet:hello-world!</h1>',
            'size': [200, 200],
            'style': {
                'background-color': 'red'
            }
        }
    },

    tree: '<node id="surface"></node>'
});

Something I noticed in part of the message after running sudo famous framwork-scafforld:

Created framework scaffold in current working directory!
Installing npm dependencies and running setup tasks
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: ENOENT, open 'public/famous-framework.development.bundle.js'
    at Error (native)
/
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "bundle"
npm ERR! node v0.12.4
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE
npm ERR! famous-framework-LawLiet-hello-world@0.0.0 bundle: `famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the famous-framework-LawLiet-hello-world@0.0.0 bundle script 'famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618'.
npm ERR! This is most likely a problem with the famous-framework-LawLiet-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618
npm ERR! You can get their info via:
npm ERR!     npm owner ls famous-framework-LawLiet-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "bundle"
npm ERR! node v0.12.4
npm ERR! npm  v2.11.0
npm ERR! path npm-debug.log.02f48f9b16b2f1c636763c8d16ab3796
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, open 'npm-debug.log.02f48f9b16b2f1c636763c8d16ab3796'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/su/Developer/WebstormProjects/trial-2/npm-debug.log

I don't know if that worth noticing, I just put it here.

@law-liet I noticed that, during this last attempt, you ran the famous framework-scaffold and npm run dev commands with sudo. That could potentially cause issues. Do you get the same result if you run them without sudo?

Well, I tried famous framework-scaffold without sudo first. It just showed the error message above and then stopped. But I tried sudo famous framework-scaffold again. The error message did not show up this time and it seemed to work at least on the scaffolding step. Then I tried npm run dev. Here's the message:

> famous-framework-LawLiet-hello-world@0.0.0 dev /Users/su/Developer/WebstormProjects/trial-3
> npm run bundle & npm run local-only-bootstrap


> famous-framework-LawLiet-hello-world@0.0.0 local-only-bootstrap /Users/su/Developer/WebstormProjects/trial-3
> famous-framework local-only-bootstrap --blocksDirectory=public --sourceDirectory=components --port=1618


> famous-framework-LawLiet-hello-world@0.0.0 bundle /Users/su/Developer/WebstormProjects/trial-3
> famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618


famous Building module LawLiet:hello-world
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: EACCES, open 'public/famous-framework.development.bundle.js'
    at Error (native)

npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "bundle"
npm ERR! node v0.12.4
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE
npm ERR! famous-framework-LawLiet-hello-world@0.0.0 bundle: `famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the famous-framework-LawLiet-hello-world@0.0.0 bundle script 'famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618'.
npm ERR! This is most likely a problem with the famous-framework-LawLiet-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     famous-framework watch-runtime --inputFile=node_modules/famous-framework/lib/index.js --outputFile=public/famous-framework.development.bundle.js --serverHost=http://localhost:1618
npm ERR! You can get their info via:
npm ERR!     npm owner ls famous-framework-LawLiet-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/su/Developer/WebstormProjects/trial-3/npm-debug.log
famous Freezing dependencies for LawLiet:hello-world...
famous    famous:core:node ~> HEAD
{ [Error: EACCES, open 'components/LawLiet/hello-world/.famous/framework.json']
  errno: -13,
  code: 'EACCES',
  path: 'components/LawLiet/hello-world/.famous/framework.json' }

Wow, how frustrating. Thank you for continuing to try.

The only other thing I can think of is that the username you entered is LawLiet... that username won't work in the framework as it turns out. We actually require that usernames be all-lowercase and hyphens only. But, of course, we totally did NOT add that to our CLI as a validation step. So, our bad for that. We are going to add a validation for that ASAP.

@law-liet -- Perhaps we can try to do a screenshare at some point this or week and go through the process step by step together? My email is matthew@famo.us if you would like to get in touch and try to get this working off-thread. Thanks again for being so patient.

Make sure to update to latest version of node 0.12... then do:

npm uninstall -g famous-cli
npm install -g famous-cli
famous login
mkdir your-project && cd your-project && famous framework-scaffold

@thealphanerd did edit

you should not have to use sudo when installing the CLI

@sebringj you should be careful about giving advice to people that involves sudo. While it might seem to "fix" the problem it actually compiles on even more. One should never be using sudo with npm.

Security concerns aside it will start plopping root owned folders in your npm cache and make it impossible for you to npm install anything with sudo.

I have tried to scaffold a project and NPM dev start multiple times but I keep getting the same errors.
Here is my log file. I am using Node installed via Brew. Not sure if that matters.

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@2.11.2
3 info using node@v0.12.5
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'predev', 'dev', 'postdev' ]
6 info predev famous-framework-blevinscm-revlog@0.0.0
7 info dev famous-framework-blevinscm-revlog@0.0.0
8 verbose unsafe-perm in lifecycle true
9 info famous-framework-blevinscm-revlog@0.0.0 Failed to exec dev script
10 verbose stack Error: famous-framework-blevinscm-revlog@0.0.0 dev: `npm run local-only-bootstrap`
10 verbose stack Exit status 1
10 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1015:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid famous-framework-blevinscm-revlog@0.0.0
12 verbose cwd /Users/cblevins/code/fam
13 error Darwin 14.3.0
14 error argv "node" "/usr/local/bin/npm" "run" "dev"
15 error node v0.12.5
16 error npm  v2.11.2
17 error code ELIFECYCLE
18 error famous-framework-blevinscm-revlog@0.0.0 dev: `npm run local-only-bootstrap`
18 error Exit status 1
19 error Failed at the famous-framework-blevinscm-revlog@0.0.0 dev script 'npm run local-only-bootstrap'.
19 error This is most likely a problem with the famous-framework-blevinscm-revlog package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     npm run local-only-bootstrap
19 error You can get their info via:
19 error     npm owner ls famous-framework-blevinscm-revlog
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]

Any help would be greatly appreciated because I am very excite to try this out.

This is a super odd one. How have you installed node?

Through Brew

Do you think that might be the issue? Sorry for the double post. Hit enter too quickly.

can you try installing with nvm and see if that makes things play better?

https://github.com/creationix/nvm

If nvm doesn't seem to work at first make sure it is being run in your bash profile. If it isn't you can add this snippet

export NVM_DIR="~/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion

I will do that and report back.

I went through and used NVM as you suggested for the stable build and it installed the CLI without issue, but when I run npm run dev I get the following

[~] $npm run dev

> famous-framework-blevinscm-revlog@0.0.0 dev /Users/cblevins
> npm run local-only-bootstrap


> famous-framework-blevinscm-revlog@0.0.0 local-only-bootstrap /Users/cblevins
> famous-framework local-only-bootstrap --sourceFolder=components --destinationFolder=public/build --servedFolder=public --port=1618

sh: famous-framework: command not found

npm ERR! Darwin 14.3.0
npm ERR! argv "/Users/cblevins/.nvm/versions/node/v0.12.5/bin/node" "/Users/cblevins/.nvm/versions/node/v0.12.5/bin/npm" "run" "local-only-bootstrap"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! famous-framework-blevinscm-revlog@0.0.0 local-only-bootstrap: `famous-framework local-only-bootstrap --sourceFolder=components --destinationFolder=public/build --servedFolder=public --port=1618`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the famous-framework-blevinscm-revlog@0.0.0 local-only-bootstrap script 'famous-framework local-only-bootstrap --sourceFolder=components --destinationFolder=public/build --servedFolder=public --port=1618'.
npm ERR! This is most likely a problem with the famous-framework-blevinscm-revlog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     famous-framework local-only-bootstrap --sourceFolder=components --destinationFolder=public/build --servedFolder=public --port=1618
npm ERR! You can get their info via:
npm ERR!     npm owner ls famous-framework-blevinscm-revlog
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/cblevins/npm-debug.log

npm ERR! Darwin 14.3.0
npm ERR! argv "/Users/cblevins/.nvm/versions/node/v0.12.5/bin/node" "/Users/cblevins/.nvm/versions/node/v0.12.5/bin/npm" "run" "dev"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! famous-framework-blevinscm-revlog@0.0.0 dev: `npm run local-only-bootstrap`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the famous-framework-blevinscm-revlog@0.0.0 dev script 'npm run local-only-bootstrap'.
npm ERR! This is most likely a problem with the famous-framework-blevinscm-revlog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run local-only-bootstrap
npm ERR! You can get their info via:
npm ERR!     npm owner ls famous-framework-blevinscm-revlog
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/cblevins/npm-debug.log

have you run npm install in the folder?

At what point do I do that because it isn't in the readme,

that should have happened when you scaffolded... it appears that things exploded earlier when making this project. npm install is a standard for any project using npm as a package manager, although we wrap this in our cli.

You may want to try making a brand new project

kk will do.

Ok I had to change the directory structure completely and it finally worked. I am not sure why it would cause issues, but the good news is I finally have the server running.

No sorry to be confusing. I just had to make sure I didn't reuse a directory name that was previously used when NPM was installed via Brew. Once I changed the name it worked.