npm ERR!安装无法't在mac上读取依赖项

npm ERR! install Couldn't read dependencies on mac

本文关键字:mac 读取 依赖 ERR 安装 npm      更新时间:2023-09-26
  • 我正在努力支持如何破解面试库https://github.com/gaylemcd/ctci/tree/master/javascript/lib/data-structures
  • 我正在努力破解JS职位的面试
  • 他们正在使用摩卡和柴,所以我正在尝试提交代码在JS中
  • 我正在尝试执行以下步骤,但在以下方面失败了步骤,npm install
  • 我收到以下错误
  • 在尝试npm install之后,我安装了Node.js

此处:

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

在我看来,您正在一个没有package.json的目录中运行npm installnpm完全不知道您希望它安装什么,除非您向它传递参数(如npm install express)或在具有package.json的目录中运行它。npm install上的文档解释了这一切。