0

I'm a Rails guy, but I'm trying to learn a bit of Angular JS. I wanted to go through this tutorial, but I can't even get a node server to start running.

Below is the npm-debug.log file

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 verbose config Skipping project config: /Users/piratetone/.npmrc. (matches userconfig)
5 verbose stack Error: ENOENT, open '/Users/piratetone/package.json'
5 verbose stack     at Error (native)
6 verbose cwd /Users/piratetone/js_projects
7 error Darwin 14.1.0
8 error argv "node" "/usr/local/bin/npm" "start"
9 error node v0.12.2
10 error npm  v2.7.4
11 error path /Users/piratetone/package.json
12 error code ENOENT
13 error errno -2
14 error enoent ENOENT, open '/Users/piratetone/package.json'
14 error enoent This is most likely not a problem with npm itself
14 error enoent and is related to npm not being able to find a file.
15 verbose exit [ -2, true ]
piratetone
  • 1,309
  • 1
  • 10
  • 13
  • Does `/usr/local/bin/npm` and/or `/Users/piratetone/package.json` exist? – l'L'l Apr 06 '15 at 22:57
  • /usr/local/bin/npm exists. It is not a directory though. package.json is NOT present though. – piratetone Apr 06 '15 at 22:59
  • I think that you've found the main issue here. – l'L'l Apr 06 '15 at 23:10
  • How do I resolve this then? I create a package.json file? I tried "npm init" and it says the file was created, but when I check the directory, the file is not present – piratetone Apr 06 '15 at 23:19
  • It must be creating it someplace else; check the log to see if it reveals the location, then try copying the file into `/Users/piratetone/` – l'L'l Apr 06 '15 at 23:21
  • Now the error looks to be - 5 verbose stack Error: missing script: start – piratetone Apr 06 '15 at 23:24
  • You need to include a start script in `package.json`. Something like: `{"scripts": {"start": "node server.js"}}` – l'L'l Apr 06 '15 at 23:39
  • holy smokes. i'm putting this on hold for now. the tutorial makes it seem like i have to just plug in a full commands. i want to code, not set up my development box. i'm getting hundreds of "npm ERR!"s associated with Darwin 14.1.0 and more when I run npm start now... looks even sloppier. likely all directory permissions issues – piratetone Apr 06 '15 at 23:45
  • I don't blame you — It's not as easy as 1, 2, 3. – l'L'l Apr 06 '15 at 23:48
  • Thanks for your help! I'm going to start completely over later tonight when I have some more time to tinker with this! Not giving up on node yet – piratetone Apr 06 '15 at 23:50
  • Maybe do a tutorial specifically for setting up node on `OS X` then try the Angular stuff, you might have better results that way. – l'L'l Apr 06 '15 at 23:51
  • 1
    I got it to work! "sudo npm start" did the trick. – piratetone Apr 06 '15 at 23:52

1 Answers1

0

Found the answer in this tutorial here. Also, after getting everything completed there, I also needed sudo to install.

sudo npm start
piratetone
  • 1,309
  • 1
  • 10
  • 13
  • 1
    Ahhh no , don't install node with sudo :) That's bad practice. You should be installing as your own user and setting the permissions (similar to how you should be doing in ruby :) See this thread for some context - http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo – Justin Maat Apr 07 '15 at 02:00