npm 安装 google-cloud 失败

npm 安装 google-cloud 失败

当我尝试安装 google-cloud npm 模块时,

npm install google-cloud

安装失败

...
npm http 200 https://registry.npmjs.org/@google-cloud/language/-/language-0.5.0.tgz
npm ERR! Error: Invalid name: "@google-cloud/speech"
npm ERR!     at ensureValidName (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:284:15)
npm ERR!     at Object.module.exports.fixNameField (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:199:5)
npm ERR!     at /usr/lib/nodejs/normalize-package-data/lib/normalize.js:29:38
npm ERR!     at Array.forEach (native)
npm ERR!     at normalize (/usr/lib/nodejs/normalize-package-data/lib/normalize.js:28:15)
npm ERR!     at final (/usr/lib/nodejs/read-package-json/read-json.js:310:33)
npm ERR!     at then (/usr/lib/nodejs/read-package-json/read-json.js:124:33)
npm ERR!     at /usr/lib/nodejs/read-package-json/read-json.js:234:40
npm ERR!     at fs.js:268:14
npm ERR!     at /usr/lib/nodejs/graceful-fs/graceful-fs.js:103:5
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!     <[email protected]>

npm ERR! System Linux 3.19.0-25-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/wall-of-moments/modules/storage
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm http 200 https://registry.npmjs.org/@google-cloud/resource/-/resource-0.3.0.tgz
npm http 200 https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz
...
npm http 200 https://registry.npmjs.org/@google-cloud/bigtable/-/bigtable-0.5.0.tgz
npm http 200 https://registry.npmjs.org/@google-cloud/common/-/common-0.7.1.tgz
npm http 200 https://registry.npmjs.org/@google-cloud/datastore/-/datastore-0.5.0.tgz
npm http 200 https://registry.npmjs.org/@google-cloud/compute/-/compute-0.3.0.tgz
npm http 200 https://registry.npmjs.org/@google-cloud/dns/-/dns-0.3.0.tgz
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/wall-of-moments/modules/storage/npm-debug.log
npm ERR! not ok code 0

npm-debug.log 的内容

...
2982 silly lockFile d04dd255-68244-0-6576037795748562-package tar:///root/tmp/npm-5916-b1AD1k53/1479718568244-0.6576037795748562/package
2983 verbose lock tar:///root/tmp/npm-5916-b1AD1k53/1479718568244-0.6576037795748562/package /root/.npm/d04dd255-68244-0-6576037795748562-package.lock
2984 silly lockFile 9d6ca3cc-68244-0-6576037795748562-tmp-tgz tar:///root/tmp/npm-5916-b1AD1k53/1479718568244-0.6576037795748562/tmp.tgz
2985 verbose lock tar:///root/tmp/npm-5916-b1AD1k53/1479718568244-0.6576037795748562/tmp.tgz /root/.npm/9d6ca3cc-68244-0-6576037795748562-tmp-tgz.lock
2986 verbose tar unpack /root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/tmp.tgz
2987 silly lockFile 31741744-8246-0-29238911252468824-package tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/package
2988 verbose lock tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/package /root/.npm/31741744-8246-0-29238911252468824-package.lock
2989 silly lockFile 37250bf7-8246-0-29238911252468824-tmp-tgz tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/tmp.tgz
2990 verbose lock tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/tmp.tgz /root/.npm/37250bf7-8246-0-29238911252468824-tmp-tgz.lock
2991 silly gunzTarPerm modes [ '755', '644' ]
2992 silly gunzTarPerm modes [ '755', '644' ]
2993 silly gunzTarPerm extractEntry package.json
2994 silly gunzTarPerm extractEntry package.json
2995 silly gunzTarPerm extractEntry README.md
2996 silly gunzTarPerm extractEntry AUTHORS
2997 silly gunzTarPerm extractEntry README.md
2998 silly gunzTarPerm extractEntry AUTHORS
2999 silly gunzTarPerm extractEntry CONTRIBUTORS
3000 silly gunzTarPerm extractEntry COPYING
3001 silly gunzTarPerm extractEntry CONTRIBUTORS
3002 silly gunzTarPerm extractEntry COPYING
3003 silly gunzTarPerm extractEntry src/iam.js
3004 silly gunzTarPerm extractEntry src/index.js
3005 silly gunzTarPerm extractEntry src/index.js
3006 silly gunzTarPerm extractEntry src/subscription.js
3007 silly gunzTarPerm extractEntry src/v1beta1/index.js
3008 silly gunzTarPerm extractEntry src/v1beta1/speech_api.js
3009 silly gunzTarPerm extractEntry src/topic.js
3010 silly gunzTarPerm extractEntry src/v1/index.js
3011 silly gunzTarPerm extractEntry src/v1beta1/speech_client_config.json
3012 silly gunzTarPerm extractEntry src/v1/publisher_api.js
3013 silly gunzTarPerm extractEntry src/v1/subscriber_api.js
3014 silly gunzTarPerm extractEntry src/v1/publisher_client_config.json
3015 silly gunzTarPerm extractEntry src/v1/subscriber_client_config.json
3016 silly lockFile 31741744-8246-0-29238911252468824-package tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/package
3017 silly lockFile 31741744-8246-0-29238911252468824-package tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/package
3018 silly lockFile 37250bf7-8246-0-29238911252468824-tmp-tgz tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/tmp.tgz
3019 silly lockFile 37250bf7-8246-0-29238911252468824-tmp-tgz tar:///root/tmp/npm-5916-b1AD1k53/1479718568246-0.29238911252468824/tmp.tgz
3020 http 200 https://registry.npmjs.org/@google-cloud/language/-/language-0.5.0.tgz
3021 silly lockFile 72e8fc78-le-cloud-speech-speech-0-4-0-tgz https://registry.npmjs.org/@google-cloud/speech/-/speech-0.4.0.tgz
3022 silly lockFile 72e8fc78-le-cloud-speech-speech-0-4-0-tgz https://registry.npmjs.org/@google-cloud/speech/-/speech-0.4.0.tgz
3023 verbose about to build /var/wall-of-moments/modules/storage/node_modules/google-cloud
3024 info /var/wall-of-moments/modules/storage/node_modules/google-cloud unbuild
3025 info preuninstall [email protected]
3026 info uninstall [email protected]
3027 verbose true,/var/wall-of-moments/modules/storage/node_modules,/var/wall-of-moments/modules/storage/node_modules unbuild [email protected]
3028 info postuninstall [email protected]
3029 error Error: Invalid name: "@google-cloud/speech"
3029 error     at ensureValidName (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:284:15)
3029 error     at Object.module.exports.fixNameField (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:199:5)
3029 error     at /usr/lib/nodejs/normalize-package-data/lib/normalize.js:29:38
3029 error     at Array.forEach (native)
3029 error     at normalize (/usr/lib/nodejs/normalize-package-data/lib/normalize.js:28:15)
3029 error     at final (/usr/lib/nodejs/read-package-json/read-json.js:310:33)
3029 error     at then (/usr/lib/nodejs/read-package-json/read-json.js:124:33)
3029 error     at /usr/lib/nodejs/read-package-json/read-json.js:234:40
3029 error     at fs.js:268:14
3029 error     at /usr/lib/nodejs/graceful-fs/graceful-fs.js:103:5
3030 error If you need help, you may report this log at:
3030 error     <http://github.com/isaacs/npm/issues>
3030 error or email it to:
3030 error     <[email protected]>
3031 error System Linux 3.19.0-25-generic
3032 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
3033 error cwd /var/wall-of-moments/modules/storage
3034 error node -v v0.10.25
3035 error npm -v 1.3.10
3036 verbose exit [ 1, true ]

有什么想法可能出错吗?据我了解,google-cloud 语音包安装失败(未找到)。我不需要它,但是运行 npm install google-cloud 时,它会自动添加。有什么方法可以避免这种情况吗?

答案1

您的 node/npm 版本太旧了。您正在使用npm 1.3.10,发布于 2013 年,远在命名空间包得到支持之前。基本上,它不知道如何处理@包名称中的 。

将 node 和 npm 更新到最新版本,一切都会正常工作。

相关内容