npm仍在将软件包安装到' / usr / local / Cellar / node /...&# 39;即使我已经卸载了Homebrew的节点版本

时间:2015-04-22 04:31:09

标签: node.js installation gruntjs npm homebrew

这是一个漫长的夜晚。最初我在https://nodejs.org/的包中安装了节点。但是,出于某种原因(我现在无法记住原因!),我决定尝试卸载它,然后通过Homebrew安装节点。

一切似乎都没事。然后我运行了以下内容:

$ npm install grunt -g
$ npm install grunt-cli -g

但是当我尝试运行任何Grunt任务时,我得到以下内容:

$ cd /some/project/that/used/grunt
$ grunt
-bash: grunt: command not found

我尝试卸载Homebrew版本的节点:

$ brew uninstall node

然后我再次安装了nodejs.org包。但是当我尝试安装一个npm包时,它最终会回到/usr/local/Cellar/node/...目录:

$ sudo npm install grunt -g
Password:
grunt@0.4.5 /usr/local/Cellar/node/0.12.2_1/libexec/npm/lib/node_modules/grunt
├── which@1.0.9
...    

我还找到https://github.com/Homebrew/homebrew/issues/22408并尝试了符号链接:

$ ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

没有运气。如何让npm停止在/usr/local/Cellar/...中安装软件包并让Grunt再次运行?谢谢!

1 个答案:

答案 0 :(得分:5)

这似乎有效。我在{{#if}}中找到了以下内容:

<div class="searchResults" id="searchResultsHTML">
<script id="result-template" type="text/x-handlebars-template">
    <table id="resultTable">
        <tr>
            <th>Personal Information</th>
            <th>Education</th>
        </tr>
        <!--- The log tag DOES output all records, even the ones that aren't showing in the HTML. --->
        {{#each this}} {{log @index}} {{log this}}
        <tr>
                    <td>{{#with basicInformation}}
                        <p>{{MASTER_CUSTOMER_ID}}&nbsp;({{CUSTOMER_STATUS_CODE}})<br />
                        {{SEARCH_NAME}}<br />
                        (<span class="lightBlue">ADD:{{ADDOPER}}&ndash;{{{d-format 'MM/DD/YYYY' (d-date 'YYYY-MM-DD' ADDDATE)}}}</span>)</p>

                        <p>DOB:{{{d-format 'MM/DD/YYYY' (d-date 'YYYY-MM-DD' BIRTH_DATE)}}}<br />
                 {{/with}}</td>

           <!--- More table columns; six total --->

            <td>{{#each education}}
                        <p>{{INSTITUTION_NAME}}&nbsp;({{{d-format 'YYYY' (d-date 'YYYY-MM-DD' BEGIN_DATE)}}}&ndash;{{{d-format 'YYYY' (d-date 'YYYY-MM-DD' END_DATE)}}})</p>
                    {{else}}
                        <p>No education records found</p>
                    {{/each}}
                </td>
        </tr>
        {{else}}
            <tr class="alert largerError" id="errorMessageRow">
            <td class="empty" id="errorMessage" colspan="6">Either there has been an error, or your search did not return any records from any datasource.</td>
        </tr>
        {{/each}}
    </table>
</script>

我删除了此行并重新安装了/usr/local/lib/node_modules/npm/npmrcprefix=/usr/local/Cellar/node/0.12.2_1/libexec/npm 个包。它现在有效。