【问题标题】:Using npm to install grunt on nodeenv results in findup-sync error使用 npm 在 nodeenv 上安装 grunt 会导致 findup-sync 错误
【发布时间】:2016-05-26 22:09:13
【问题描述】:

使用nodeenv建立节点virtualenv后,我使用source /bin/activate 切换到正确的目录,更新npm,然后执行

npm install -g gruntnpm install -g grunt-cli 我收到同样的错误:

npm ERR! Linux 3.13.0-53-generic
npm ERR! argv "node" "/home/{redacted-home-dir}/NodeProjects/vue/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.4
npm ERR! npm  v2.11.1
npm ERR! file /home/{redacted-home-dir}/.npm/findup-sync/0.1.3/package/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR! 
npm ERR! ^
npm ERR! File: /home/{redacted-home-dir}/.npm/findup-sync/0.1.3/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.parse
npm ERR! Please include the following file with any support request:
npm ERR!     /home/{redacted-home-dir}/NodeProjects/vue/npm-debug.log

A similar error 被记录在 findup-sync Github 上,但这是 npm 的最新版本。

根据 npm 文档,Grunt 的 package.json 说“大约 0.1.2”。

我也尝试过独立安装 findup-sync,但无济于事。

关于我的计算机的其他详细信息:Linux (Debian/Ubuntu 14.04)。 64位。

【问题讨论】:

    标签: node.js gruntjs npm


    【解决方案1】:

    您的缓存可能已损坏:npm cache clean

    【讨论】:

    • 我下载了这个包,我有同样的npm,package.json是对的。我唯一一次遇到这种错误是在 npm install 在写入文件时被杀死之后,所以唯一的解决方案是清除文件,在他的情况下是缓存。
    • 非常感谢您的回答。我永远不会想到这一点,因为我对 Node.js 世界还很陌生。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-17
    • 1970-01-01
    • 1970-01-01
    • 2017-01-20
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多