gpt4 book ai didi

node.js - 无法使用 npm 安装 Bower

转载 作者:太空宇宙 更新时间:2023-11-03 22:37:37 25 4
gpt4 key购买 nike

我的系统上安装了 Node.js (v0.10.26),并且我正在尝试安装 Bower 包管理器。但我无法安装。我不断收到错误消息。我将我的 npm-debug.txt 与 jsfiddle 放在一起供您引用。

这是我收到的错误:

D:\mySite>npm install bower
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/insight
npm http GET https://registry.npmjs.org/is-root
npm http GET https://registry.npmjs.org/cardinal
npm http GET https://registry.npmjs.org/bower-registry-client
npm http GET https://registry.npmjs.org/chmodr
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/fstream-ignore
npm http GET https://registry.npmjs.org/junk
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/decompress-zip
npm http GET https://registry.npmjs.org/mout
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/opn
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/promptly
npm http GET https://registry.npmjs.org/p-throttler
npm http GET https://registry.npmjs.org/request-progress
npm http GET https://registry.npmjs.org/retry
npm http GET https://registry.npmjs.org/lockfile
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/stringify-object
npm http GET https://registry.npmjs.org/shell-quote
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/tmp
npm http GET https://registry.npmjs.org/update-notifier
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/bower-config
npm http GET https://registry.npmjs.org/inquirer
npm http GET https://registry.npmjs.org/archy
npm http GET https://registry.npmjs.org/bower-endpoint-parser
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/bower-json
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/bower-logger
npm http GET https://registry.npmjs.org/cardinal
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/bower-config
npm http GET https://registry.npmjs.org/promptly
npm http GET https://registry.npmjs.org/update-notifier
npm http GET https://registry.npmjs.org/chmodr
npm http GET https://registry.npmjs.org/archy
npm http GET https://registry.npmjs.org/lockfile
npm http GET https://registry.npmjs.org/mout
npm http GET https://registry.npmjs.org/is-root
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/bower-json
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/opn
npm http GET https://registry.npmjs.org/shell-quote
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/tmp
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/request-progress
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/p-throttler
npm http GET https://registry.npmjs.org/stringify-object
npm http GET https://registry.npmjs.org/bower-endpoint-parser
npm http GET https://registry.npmjs.org/junk
npm http GET https://registry.npmjs.org/retry
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/bower-logger
npm http GET https://registry.npmjs.org/inquirer
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/bower-registry-client
npm http GET https://registry.npmjs.org/decompress-zip
npm http GET https://registry.npmjs.org/insight
npm http GET https://registry.npmjs.org/fstream-ignore
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/cardinal
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/bower-config
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lockfile
npm http GET https://registry.npmjs.org/promptly
npm http GET https://registry.npmjs.org/chmodr
npm http GET https://registry.npmjs.org/mout
npm http GET https://registry.npmjs.org/update-notifier
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/shell-quote
npm http GET https://registry.npmjs.org/inquirer
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/tmp
npm http GET https://registry.npmjs.org/opn
npm http GET https://registry.npmjs.org/p-throttler
npm http GET https://registry.npmjs.org/bower-logger
npm http GET https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/bower-json
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/bower-endpoint-parser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/request-progress
npm http GET https://registry.npmjs.org/stringify-object
npm http GET https://registry.npmjs.org/junk
npm http GET https://registry.npmjs.org/retry
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/semver
npm ERR! Failed to parse json
npm ERR! Unexpected token
npm ERR! File: C:\Users\mb112830\AppData\Roaming\npm-cache\update-noti
\package\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.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bower"
npm ERR! cwd D:\mySite
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! file C:\Users\mb112830\AppData\Roaming\npm-cache\update-notif
package\package.json
npm ERR! code EJSONPARSE
npm http GET https://registry.npmjs.org/is-root
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/archy
npm http GET https://registry.npmjs.org/decompress-zip
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/bower-registry-client
npm http GET https://registry.npmjs.org/insight
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/fstream-ignore
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\mySite\npm-debug.log
npm ERR! not ok code 0

请找到日志 here 的 jsfiddle 链接.

我还清理了我的 npm 缓存并再次尝试,但这次我得到了这个错误:

npm ERR! network tunneling socket could not be established, cause=Parse Error
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bower"
npm ERR! cwd D:\bower
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\bower\npm-debug.log
npm ERR! not ok code 0

我该如何解决这个问题?

最佳答案

您必须指定 Bower 的安装路径。应将路径添加到您的 zshrc 文件或 bashrc 文件中,如下所示。

export PATH =/usr/local/lib/node_modules/:$PATH 

关于node.js - 无法使用 npm 安装 Bower,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23514087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com