错误的ERR!安装无法读取mac上的依赖项

3 javascript git macos node.js npm

  • 我正在努力支持如何破解面试资料库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
Run Code Online (Sandbox Code Playgroud)

你能告诉我怎么解决吗?

git clone https://github.com/gaylemcd/ctci.git
cd ctci/javascript
npm install
npm install -g mocha
mocha --recursive
Run Code Online (Sandbox Code Playgroud)

Ken*_*nan 9

它看起来像你npm install在没有a的目录中运行package.json.npm绝对不知道你想要它安装什么,除非你传递它的参数(比如npm install express)或者在一个目录中运行它package.json.该文档上npm install解释了这一切.