【问题标题】:NPM Start isn't working (Can't get Node working on Mac OS X Yosemite)NPM Start 不工作(无法让 Node 在 Mac OS X Yosemite 上工作)
【发布时间】:2015-04-07 07:53:31
【问题描述】:

我是一名 Rails 人,但我正在尝试学习一点 Angular JS。我想通过this tutorial,但我什至无法让节点服务器开始运行。

下面是 npm-debug.log 文件

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 ]

【问题讨论】:

  • /usr/local/bin/npm 和/或 /Users/piratetone/package.json 存在吗?
  • /usr/local/bin/npm 存在。虽然它不是一个目录。 package.json 不存在。
  • 我认为您在这里找到了主要问题。
  • 那我该如何解决呢?我创建一个 package.json 文件?我尝试了“npm init”,它说文件已创建,但是当我检查目录时,文件不存在
  • 我让它工作了! “sudo npm start”成功了。

标签: angularjs node.js macos npm


【解决方案1】:

this tutorial here. 找到答案另外,在那里完成所有工作后,我还需要安装 sudo。

sudo npm start

【讨论】:

  • 啊,不,不要用 sudo 安装节点 :) 这是不好的做法。您应该以自己的用户身份安装并设置权限(类似于您应该在 ruby​​ 中执行的操作:)有关某些上下文,请参阅此线程 - stackoverflow.com/questions/16151018/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-03
  • 2011-10-11
相关资源
最近更新 更多