[英]Node.js: Error deploying to Heroku when added googleapis package
我在前一行中添加到package.json中,它在本地完美運行,但是當我部署到heroku時,它被拒絕了。
錯誤:找不到兼容的版本:Inherits @'^ 2.0.1'
package.json
"googleapis": ">= 0.0.0",
Heroku部署日志:
-----> Deleting 2 files matching .slugignore patterns.
-----> Removing .DS_Store files
-----> Fetching custom git buildpack... done
-----> Node.js app detected
-----> Requested node range: 0.8.21
-----> Resolved node version: 0.8.21
-----> Downloading and installing node
-----> Restoring node_modules directory from cache
-----> Pruning cached dependencies not specified in package.json
-----> Exporting config vars to environment
-----> Installing dependencies
npm http GET https://registry.npmjs.org/googleapis
npm http 200 https://registry.npmjs.org/googleapis
npm http GET https://registry.npmjs.org/googleapis/-/googleapis-1.0.9.tgz
npm http 200 https://registry.npmjs.org/googleapis/-/googleapis-1.0.9.tgz
npm http GET https://registry.npmjs.org/async/0.2.10
npm http GET https://registry.npmjs.org/gapitoken/0.1.2
npm http GET https://registry.npmjs.org/multipart-stream/1.0.0
npm http GET https://registry.npmjs.org/request/2.37.0
npm http 200 https://registry.npmjs.org/gapitoken/0.1.2
npm http GET https://registry.npmjs.org/gapitoken/-/gapitoken-0.1.2.tgz
npm http 200 https://registry.npmjs.org/multipart-stream/1.0.0
npm http GET https://registry.npmjs.org/multipart-stream/-/multipart-stream-1.0.0.tgz
npm http 200 https://registry.npmjs.org/gapitoken/-/gapitoken-0.1.2.tgz
npm http 200 https://registry.npmjs.org/request/2.37.0
npm http 200 https://registry.npmjs.org/async/0.2.10
npm http GET https://registry.npmjs.org/request/-/request-2.37.0.tgz
npm http GET https://registry.npmjs.org/async/-/async-0.2.10.tgz
npm http 200 https://registry.npmjs.org/multipart-stream/-/multipart-stream-1.0.0.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.37.0.tgz
npm http 200 https://registry.npmjs.org/async/-/async-0.2.10.tgz
npm http GET https://registry.npmjs.org/jws/0.0.2
npm http GET https://registry.npmjs.org/sandwich-stream
npm http GET https://registry.npmjs.org/inherits
npm http 200 https://registry.npmjs.org/jws/0.0.2
npm http 200 https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/hawk/1.1.1
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/jws/-/jws-0.0.2.tgz
npm http 200 https://registry.npmjs.org/mime-types
npm http 200 https://registry.npmjs.org/sandwich-stream
npm ERR! Error: No compatible version found: inherits@'^2.0.1'
npm ERR! Valid install targets:
npm ERR! ["1.0.0","2.0.0","2.0.1"]
npm ERR! at installTargetsError (/tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/vendor/node/lib/node_modules/npm/lib/cache.js:679:10)
npm ERR! at /tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/vendor/node/lib/node_modules/npm/lib/cache.js:594:10
npm ERR! at saved (/tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/vendor/node/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR! at Object.oncomplete (fs.js:297:15)
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 Linux 3.8.11-ec2
npm ERR! command "/tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/vendor/node/bin/node" "/tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f/.npmrc" "--production"
npm ERR! cwd /tmp/build_63edc9a5-ba9f-4380-9d67-15fc37cf717f
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
有什么想法嗎?
解決了升級Node版本和npm的問題。 節點為0.8.21,npm為1.2.10。
升級后的package.json:
"node": "0.10.30",
"npm": "1.3.6"
實際上,似乎npm版本與heroku無關:
無需指定npm版本,因為npm與節點捆綁在一起。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.