本文介绍了Heroku推送拒绝无法编译node.js应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
计数对象:21,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(19/19),完成。
写作对象:100%(21/21),3.44 KiB,完成。
总计21(增量5),重用0(增量0)
-----> Node.js应用检测到
----->解决引擎版本
警告:在package.json中未指定任何Node.js版本,请参阅:
https://devcenter.heroku.com/articles/nodejs-versions
使用Node.js版本:0.10.5
使用npm版本:1.2.18
----->获取Node.js二进制文件
----->将节点卖给slug
----->使用npm
安装依赖关系npm ERR!安装无法读取依赖项
npm ERR!无法解析json
npm ERR!意外的令牌}
npm ERR!文件:/tmp/build_1nxuppeok7fl7/package.json
npm ERR!无法解析package.json数据。
npm ERR! package.json必须是实际的JSON,而不仅仅是JavaScript。
npm ERR!
npm ERR!这不是npm中的错误。
npm ERR!告诉软件包作者修复他们的package.json文件。 JSON.parse
npm ERR!系统Linux 2.6.32-350-ec2
npm ERR!命令/ tmp / node-node-8tU8 / bin / node/tmp/node-npm-iUEr/cli.jsinstall--production
npm ERR! cwd / tmp / build_1nxuppeok7fl7
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR!文件/tmp/build_1nxuppeok7fl7/package.json
npm ERR!代码EJSONPARSE
npm ERR!
npm ERR!附加的日志记录细节可以在以下位置找到:
npm ERR! /tmp/build_1nxuppeok7fl7/npm-debug.log
npm ERR!不好的代码0
!无法安装 - 生产依赖与npm
0信息它工作,如果它以ok结束
1详细cli ['/ tmp / node-node-8tU8 / bin / node',
1 verbose cli'/tmp/node-npm-iUEr/cli.js',
1 verbose cli'install',
1 verbose cli'--production']
2使用npm @ 1.2.18
3信息使用[email protected]
4详细读取json /tmp/build_1nxuppeok7fl7/package.json
5错误安装无法读取依存关系
6错误失败解析json
6错误意外标记}
7错误文件:/tmp/build_1nxuppeok7fl7/package.json
8错误解析package.json数据失败。
8错误package.json必须是实际的JSON,而不仅仅是JavaScript。
8错误
8错误这不是npm中的错误。
8错误告诉软件包作者修正他们的package.json文件。 JSON.parse
9错误系统Linux 2.6.32-350-ec2
10错误命令/ tmp / node-node-8tU8 / bin / node/ tmp / node -npm-iUEr / cli .jsinstall--production
11错误cwd / tmp / build_1nxuppeok7fl7
12错误节点-v v0.10.5
13错误npm -v 1.2.18
14错误文件/tmp/build_1nxuppeok7fl7/package.json
15错误代码EJSONPARSE
16详细退出[1,true]
! Heroku推送被拒绝,未能编译Node.js应用程序
到[email protected]:hidden-hamlet-7335.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将一些文件推送到'[email protected]:hidden-hamlet-7335.git'
这里是我的package.json(如果你想知道我已经在本地安装了依赖关系并且package.json有效)
{
name:Simple-chat-application,
version:0.0.1,
private :true,
scripts:{
start:node app
},
dependencies:{
express:3.1。 0,
jade:0.28.1,
socket.io:0.9.13
},
engines:{
节点:0.10.x,
npm:1.2.x
}
}
解决方案
问题出在git add上,我忘了添加node_modules files.I关闭终端并运行给定的命令集在Heroku和NodeJs入门[1]中。应用程序被成功地压入了
[1] -
I get the following error message on pushing to heroku:
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 3.44 KiB, done.
Total 21 (delta 5), reused 0 (delta 0)
-----> Node.js app detected
-----> Resolving engine versions
WARNING: No version of Node.js specified in package.json, see:
https://devcenter.heroku.com/articles/nodejs-versions
Using Node.js version: 0.10.5
Using npm version: 1.2.18
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected token }
npm ERR! File: /tmp/build_1nxuppeok7fl7/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Linux 2.6.32-350-ec2
npm ERR! command "/tmp/node-node-8tU8/bin/node" "/tmp/node-npm-iUEr/cli.js" "install" "--production"
npm ERR! cwd /tmp/build_1nxuppeok7fl7
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! file /tmp/build_1nxuppeok7fl7/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_1nxuppeok7fl7/npm-debug.log
npm ERR! not ok code 0
! Failed to install --production dependencies with npm
0 info it worked if it ends with ok
1 verbose cli [ '/tmp/node-node-8tU8/bin/node',
1 verbose cli '/tmp/node-npm-iUEr/cli.js',
1 verbose cli 'install',
1 verbose cli '--production' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json /tmp/build_1nxuppeok7fl7/package.json
5 error install Couldn't read dependencies
6 error Failed to parse json
6 error Unexpected token }
7 error File: /tmp/build_1nxuppeok7fl7/package.json
8 error Failed to parse package.json data.
8 error package.json must be actual JSON, not just JavaScript.
8 error
8 error This is not a bug in npm.
8 error Tell the package author to fix their package.json file. JSON.parse
9 error System Linux 2.6.32-350-ec2
10 error command "/tmp/node-node-8tU8/bin/node" "/tmp/node-npm-iUEr/cli.js" "install" "--production"
11 error cwd /tmp/build_1nxuppeok7fl7
12 error node -v v0.10.5
13 error npm -v 1.2.18
14 error file /tmp/build_1nxuppeok7fl7/package.json
15 error code EJSONPARSE
16 verbose exit [ 1, true ]
! Heroku push rejected, failed to compile Node.js app
To [email protected]:hidden-hamlet-7335.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:hidden-hamlet-7335.git'
And here's my package.json(In case you want to know I have installed dependencies locally and package.json works)
{
"name": "Simple-chat-application",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"express": "3.1.0",
"jade": "0.28.1",
"socket.io": "0.9.13"
},
"engines": {
"node": "0.10.x",
"npm": "1.2.x"
}
}
解决方案
The problem was with git add.I had forgotten to add the node_modules files.I closed the terminal and ran the set of commands given in the Getting started with Heroku and NodeJs[1] again.The application was successfully pushed onto the stack.
[1]-https://devcenter.heroku.com/articles/nodejs
这篇关于Heroku推送拒绝无法编译node.js应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!