我想启动一个 node 应用程序,并创建了一个包含教程的package.json文件.以下是json文件:

{
    "name": "Dashboard",
    "version": "0.0.0",
    "description": "Client-A Dashboard",
    "dependencies": {
        "socket.io": "latest",
        "express": "latest",
        "jade": "latest"
    },
    "author": "tD"
}

在try 运行JSON文件之前,我验证了它,但当我运行npm install命令时,仍然收到一条错误消息:

npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open 'C:\projects\Client-A\Live\package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\projects\Client-A\Live\
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path C:\projects\Client-A\Live\package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\projects\Client-A\Live\npm-debug.log
npm ERR! not ok code 0

这是npm-degub.log号文件

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using npm@1.2.14
3 info using node@v0.8.22
4 verbose node symlink C:\Program Files (x86)\nodejs\\node.exe
5 verbose read json C:\projects\Client-A\Live\package.json
6 error install Couldn't read dependencies
7 error Error: ENOENT, open 'C:\projects\Client-A\Live\package.json'
8 error If you need help, you may report this log at:
8 error     <http://github.com/isaacs/npm/issues>
8 error or email it to:
8 error     <npm-@googlegroups.com>
9 error System Windows_NT 6.1.7601
10 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
11 error cwd C:\projects\Client-A\Live\scoreboard
12 error node -v v0.8.22
13 error npm -v 1.2.14
14 error path C:\projects\Client-A\Live\package.json
15 error code ENOENT
16 error errno 34
17 verbose exit [ 34, true ]

推荐答案

try 添加以下内容:

"private": true,

这对我很管用.

EDIT(对于询问原因的人):

Oficial documentation条规定如下:


If you set 100 in your package.json, then npm will refuse to publish it. This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the 101 hash described below to override the 102 config param at publish-time.


你收到的错误消息可能在某种程度上与违反此"规则"有关(我的是).

  • 要么你将未发布的软件包(比如你自己的应用)标记为
  • 或者你完全忽略了任何价值.

Node.js相关问答推荐

如何在MongoDB中更新嵌套数组

如何在医学中按patientId查找一个并同时插入多个数据

TS[2339]:类型 '() => Promise<(Document & Omit) | 上不存在属性空>'

使用单个 MongoDB 查询更新多个元素

使用NodeJS通过服务账号列出Google Workspace用户

运行本地移动自动化测试时,在onPrepare钩子中,ERROR @wdio/cli:utils: A service failed in the 'onPrepare'

数据未被中间件解析

Nodejs 从链接数组中获取数据并保存到 mongodb

为什么后端开发需要单独的服务器?

BrowserRouter工作时为什么HashRouter不工作?

JavaScript & Node - 将图像文件保存到服务器但无法查看

Firestore promise 在退货前等待产品详细信息

Node js中向rest服务发送https请求的步骤

用于排除多个文件的 node.js glob 模式

如何为 node.js 服务器分配域名?

使用 NodeJS 将新对象附加到 DynamoDB 中的 JSON 数组

node.js(ES6 / Babel)中 import X 和 import * as X 的区别?

Bootstrap 中的 Grunt 依赖冲突

请求新页面时如何将 AngularJS 路由与 Express (Node.js) 一起使用?

在 Node.js 上使用 Connect 无法获取 /