bower TypeError无法读取未定义的属性'linked'

时间:2017-01-02 04:43:07

标签: node.js npm bower

我遇到了bower install --save的问题,在运行命令时看起来好像是在尝试将空字符串作为包安装,输出如下,堆栈跟踪如下:

bower jquery                    extra-resolution Unnecessary resolution: jquery#~2.1.4
bower                                      error Cannot read property 'linked' of undefined

Stack trace:
TypeError: Cannot read property 'linked' of undefined
    at Manager.<anonymous> (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/core/Manager.js:644:28)
    at /home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/function/makeIterator_.js:20:32
    at /home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/object/filter.js:12:17
    at /home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/object/forOwn.js:12:27
    at exec (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/object/forIn.js:71:19)
    at forIn (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/object/forIn.js:38:17)
    at forOwn (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout/object/forOwn.js:10:9)
    at Object.filterValues [as filter] (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/mout
/object/filter.js:11:9)
    at Manager.<anonymous> (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/core/Manager.js:639:39)
    at _fulfilled (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/q/q.js:834:54)

Console trace:
Error
    at StandardRenderer.error (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/renderers/StandardRenderer
.js:81:37)
    at Logger.<anonymous> (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/bin/bower.js:110:26)
    at emitOne (events.js:96:13)
    at Logger.emit (events.js:188:7)
    at Logger.emit (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.
js:29:39)
    at /home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/commands/index.js:48:20
    at _rejected (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/q/q.js:844:24)
    at /home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/q/q.js:870:30
    at Promise.when (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/home/jkruse/.nvm/versions/node/v6.9.2/lib/node_modules/bower/lib/node_modules/q/q.
js:788:41)

System info:
Bower version: 1.8.0
Node version: 6.9.2
OS: Linux 4.8.6-300.fc25.x86_64 x64

bower.json:

{
  "name": "inspinia",
  "version": "2.5.0",
  "dependencies": {
    "angular-animate": "~1.5.0",
    "angular-cookies": "~1.5.0",
    "angular-touch": "~1.5.0",
    "angular-sanitize": "~1.5.0",
    "angular-messages": "~1.5.0",
    "angular-aria": "~1.5.0",
    "jquery": "~2.1.4",
    "angular-resource": "~1.5.0",
    "angular-ui-router": "~0.2.15",
    "bootstrap": "^3.3.7",
    "angular-bootstrap": "~1.1.2",
    "moment": "^2.15.1",
    "animate.css": "~3.4.0",
    "angular": "~1.5.0",
    "pace": "~1.0.2",
    "metisMenu": "~2.0.2",
    "fontawesome": "~4.5.0",
    "ng-token-auth": "^0.0.29",
    "oclazyload": "^1.0.9",
    "angular-ui-calendar": "^1.0.2",
    "angular-daterangepicker": "^0.2.2",
    "angular-route": "^1.5.8",
    "angular-scroll-glue": "^2.0.7",
    "angular-ui-select": "^0.19.4",
    "angular-socket-io": "^0.7.0",
    "angular-ui-tree": "^2.17.0",
    "angular-modal-service": "^0.10.1",
    "angular-object-diff": "^1.0.3",
    "bootstrap-multimodal": "^1.0.4",
    "angular-timer": "^1.3.4",
    "chart.js": "^2.2.2",
    "angular-morris": "^1.3.0",
    "pdfmake": "^0.1.20",
    "angular-audio": "^1.7.3"
  },
  "devDependencies": {
    "angular-mocks": "~1.5.0"
  },
  "overrides": {
    "bootstrap": {
      "main": [
        "less/bootstrap.less",
        "dist/fonts/glyphicons-halflings-regular.eot",
        "dist/fonts/glyphicons-halflings-regular.svg",
        "dist/fonts/glyphicons-halflings-regular.ttf",
        "dist/fonts/glyphicons-halflings-regular.woff",
        "dist/fonts/glyphicons-halflings-regular.woff2"
      ]
    },
    "fontawesome": {
      "main": [
        "less/font-awesome.less",
        "fonts/fontawesome-webfont.eot",
        "fonts/fontawesome-webfont.svg",
        "fonts/fontawesome-webfont.ttf",
        "fonts/fontawesome-webfont.woff",
        "fonts/fontawesome-webfont.woff2"
      ]
    }
  },
  "resolutions": {
    "jquery": "~2.1.4",
    "angular": "1.5.8"
  }
}

我是凉亭和这个项目的新手。我在npm install之后运行了凉亭(我不确定这是否相关)。如果我能提供更多信息,请告诉我。

谢谢!

1 个答案:

答案 0 :(得分:0)

这是用户错误。作为Bower的新手,我不明白当它要求为包装澄清合适的版本时,您应该使用所提供选项的列表编号 - 而不是您想要的版本号! (见图)

enter image description here

所以,对于答案,当我刚刚使用 5 时输入 2.17

那令人尴尬......