2

私はnodejsが初めてです。ドキュメントに従ってnodejsをインストールしようとしていました。npm install コマンドを使用して依存関係をインストールしているときに、エラーが発生しました。

C:\Program Files\nodejs>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.12
npm ERR! path C:\Program Files\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\
nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Program Files\nodejs\npm-debug.log

C:\Program Files\nodejs>

package.json ファイルが存在するフォルダーで npm install コマンドを実行すると、次のエラーが発生します。

C:\Program Files\nodejs>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.12
npm ERR! path C:\Program Files\nodejs\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! package.json ENOENT: no such file or directory, open 'C:\Program Files\
nodejs\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Program Files\nodejs\npm-debug.log

C:\Program Files\nodejs>

npm-debugログファイルへのリンク.. どんな助けでも大歓迎です..ありがとう..

4

5 に答える 5

2

依存関係ノードをインストールするには、プロジェクトのルートにある というファイルを探しますpackage.json。ここには、プロジェクトに必要なすべての依存関係のリストがあります。その内容は次のようになります

package.jsonプロジェクトのルートに行方不明のようです。

依存関係をインストールするには、通常、次のようなコマンドを実行します

npm install NAMEOFTHEDEPENDENCY --save-dev

NAMEOFTHEDEPENDENCY はgrunt-contrib-sass、たとえば

これにより、package.json

于 2016-02-20T15:18:27.690 に答える
0

nodejs フォルダーで npm install を実行しています。プロジェクト フォルダーで実行する必要があります。npm がパスにあることを確認してください。

于 2016-02-20T15:16:49.823 に答える