尝试安装指南针时出错npm ERR!无法读取属性'长度'未定义的

时间:2017-07-20 19:53:42

标签: node.js linux gruntjs compass grunt-contrib-compass

我正在尝试将罗盘安装到我的托管服务器上,并且我不断将上述错误反馈给shell。

npm ERR! Cannot read property 'length' of undefined

我已经在一些解决方法之后安装了node,grunt,contrib-watch和contrib-uglify。我需要的最后一个依赖是指南针。

在我到达最底层之前,我没有看到日志中的任何错误:

4924 error Linux 3.12.18-clouder0
4925 error argv "/home/joshuag3/bin/node" "/home/joshuag3/bin/npm" "install" "grunt-contrib-watch" "--save-dev"
4926 error node v4.4.1
4927 error npm  v2.14.20
4928 error code EPEERINVALID
4929 error peerinvalid The package grunt@1.0.1 does not satisfy its siblings' peerDependencies requirements!
4929 error peerinvalid Peer grunt-contrib-uglify@0.2.7 wants grunt@~0.4.0
4930 verbose exit [ 1, true ]

我对节点和这类事物非常新。如果有解决方案请过分解释。

2 个答案:

答案 0 :(得分:0)

查看谷歌 - 在github上有很多类似的问题。也许你会在那里找到答案。

答案 1 :(得分:0)

打开cmd,然后转到根用户文件夹(例如C:\Users\User)并运行npm install -g npm@latest

这会将您的npm更新到最新版本。再次尝试安装,现在应该可以正常工作。

此外,您可以在npm audit fix之后使用npm install -g npm@latest