错误的ERR! package.json npm在当前目录中找不到package.json文件

时间:2015-06-08 18:58:08

标签: node.js

我正在尝试使用node设置一个简单的服务器实现,但是会收到此错误:

AC-MacBook-Pro:comments_box ac$ ls
bower_components    comments.json       components.jsx      index.html      node_modules        npm-debug.log
AC-MacBook-Pro:comments_box ac$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/Users/ac/Projects/funning_around/reactjs/comments_box/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/ac/Projects/funning_around/reactjs/comments_box
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! path /Users/ac/Projects/funning_around/reactjs/comments_box/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/ac/Projects/funning_around/reactjs/comments_box/npm-debug.log
npm ERR! not ok code 0

1 个答案:

答案 0 :(得分:4)

package.json缺失,因为错误明确指出。您应该创建此文件。它可以手动完成,但第一次npm init可能正是您所需要的。