安装npm时出错,提示“在mac上无法读取依赖项”。

3
  • 我正在尝试支持如何破解面试存储库 https://github.com/gaylemcd/ctci/tree/master/javascript/lib/data-structures
  • 我正在努力破解JS职位的面试
  • 他们正在使用mocha和chai,所以我正在尝试提交JS代码
  • 我正在尝试执行以下步骤,但在以下步骤中失败: npm install
  • 我遇到了以下错误
  • 我已经安装了Node.js,之后尝试了npm install

这里:

npm ERR! install **Couldn't read dependencies**
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! path /Users/Raj/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2

npm ERR! package.json ENOENT, open '/Users/Raj/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! Please include the following file with any support request:
npm ERR!     /Users/Raj/Desktop/ctci/npm-debug.log

你能告诉我如何解决这个问题吗?
git clone https://github.com/gaylemcd/ctci.git
cd ctci/javascript
npm install
npm install -g mocha
mocha --recursive
1个回答

10

看起来你是在没有 package.json 文件的目录中运行了 npm install。除非你传递参数(例如 npm install express)或在带有 package.json 的目录中运行,否则 npm 完全不知道你想安装什么。关于 npm install文档可以解释所有这些。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接