NPM 电子生命周期错误 - 使用节点服务器.js命令



我正在 IBM Watson 上部署测试机器人,https://github.com/eciggaar/text-bot 当我尝试使用 CLI 代工厂在本地部署代码时,它收到以下错误。

我正在使用 Nodejs 版本 6.10.3 和 npm 版本 5.0.4

有人可以帮我解决这个问题吗?

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! text-bot@0.1.2 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the text-bot@0.1.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersPRERNA CHUGHAppDataRoamingnpm-cache_logs2017-06-29T13_36_22_995Z-debug.log

有时,当您已经启动 Web 服务器时,如果您尝试在另一个终端 (cmd( 上再次运行 npm 命令,则会出现ELIFECYCLE错误。确保在同一端口中没有运行任何其他实例。

尝试通过以下方式清理缓存:与管理员/根npm cache clean并删除您的node_modules,完成此步骤后,尝试使用npm install --save再次安装软件包

检查 package.json 文件中的映射。

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "dependencies": {},
  "scripts": {
    "start": "node ."
  },
  "author": "",
  "license": "ISC"
}

确保服务器.js存在于应用程序目录中。

如果清除缓存不起作用,则此步骤可能。尝试终止在特定端口上运行的进程(假设为 3000(。它在我的情况下有效。在您的终端中键入以下内容,并确保您也在正确的目录中。

lsof -n -i4TCP:3000 | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9

祝你好运!!

就我而言,是我的防火墙阻止了某些程序对互联网的访问。

如果您使用Windows操作系统,则PATH环境变量不包括"node"目录。检查并添加它。也许它有帮助。

  1. 用回显 %PATH% 检查
  2. 然后添加它设置路径=%路径;
  3. 然后再次尝试安装

问候

最新更新