0

クリスマスに node.js を使用してプロジェクトを作成したいと考えており、今月の .Net マガジンのチュートリアルを使用して私を助けています。Henrik Joretag によって書かれた 私は十分に単純だと思っていましたが、最初のハードルで問題にぶつかったようです。

package.json ファイルを作成したら、それを実行してみます。次のエラーが表示されます。

error TypeError: Cannot call method 'replace' of undefined
error     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-    json.js:332:45
error     at fs.js:117:20
error     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:53:5
error     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:62:5
error     at Object.oncomplete (fs.js:297:15)

チュートリアルでは、package.json ファイルを作成した後は機能するはずであると述べているため、これを構成する方法について完全に迷っています。私のpackage.jsonは次のようになります。

{
    "name": "sample-dashboard.iwishiwaschucknorris.com",
    "version" : "0.0.1",
    "homepage" : "http://sample-dashboard.iwishiwaschucknorris.com",
    "description" : "Mind-meldification for teams",
    "dependencies" : {
        "backbone" : "",
        "underscore" : "",
        "express" : "",
        "stitch" : "",
        "andbang-express-auth" : "",
        "precommit-hook" : "",
        "clientmodules" : "",
        "templatizer" : "",
        "andlog" : "",
        "getconfig" : "",
        "connect-githead" : ""
    },
    "clientmodules" : ["andlog","backbone","underscore"],
    "main" : "server.js",
    "scripts" : {
        "postinstall" : "node node_modules/clientmodules/install.js"
    }
}

私は本当にnodeとbackbone.jsに慣れたいと思っているので、これに関する助けは素晴らしいでしょう。

4

3 に答える 3

2

これと同じ問題がありました。

この投稿に基づいて、私はやったが、幸せにgit initなるためにはもう少し先に進む必要があることがわかりました.npm

先に進み、ディレクトリで agit add .と agit commit -m "<msg>"を実行して、最初のコミットを git メタデータに記録しました。その後、再実行しましたがnpm install、すべて問題ありませんでした。

于 2012-12-31T15:17:21.153 に答える
0

npm installのディレクトリ内から実行しないでください。このディレクトリは、で宣言されpackage.jsonているすべてのをローカルにインストールし、スクリプトを実行します。dependenciespackage.jsonpostinstall

于 2012-12-24T10:14:28.210 に答える
0

これはおそらく、最近修正した古い npm バグです。npm update -g npmこれで準備完了です。(.git はあるが git HEAD がない場合に発生します)

于 2012-12-24T11:36:28.313 に答える