2017-01-25 24 views
2

NPMに問題があります。最近では、いつでもスクリプトを実行しようとするとnpmが常にエラーを返します

package.json ...私は、スクリプトが正しい知っている場合でも、それは私にエラーの壁全体を与えるNPMでスクリプトを実行しようとすると、なぜ私が理解することはできません

{ 
    "name": "testing", 
    "version": "1.0.0", 
    "description": "", 
    "main": "index.js", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "author": "", 
    "license": "ISC" 
} 

あなたは、これはちょうどnpm initを実行し、ちょうど倍のカップル...入力して、私はnpm run testを実行すると、まだ私はこれを取得打った後に生成されて見ることができるように...

> [email protected] test C:\Users\user\Desktop\testing 
> echo "Error: no test specified" && exit 1 

"Error: no test specified" 

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test" 
npm ERR! node v7.4.0 
npm ERR! npm v4.1.2 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] test: `echo "Error: no test specified" && exit 1` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] test script 'echo "Error: no test specified" && exit 1'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the testing package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  echo "Error: no test specified" && exit 1 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs testing 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls testing 
npm ERR! There is likely additional logging output above. 
npm WARN Local package.json exists, but node_modules missing, did you mean to install? 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\user\Desktop\testing\npm-debug.log 

次のエラーメッセージで見ることができるように私はノードv7.4.0とnpm v4.1.2を持っています...以前は私ノードv6.9.2を実行していましたが、このエラーが発生した後も更新されましたが、まだ変更されていません...また、重要かどうかは分かりませんが、Windows 10を実行しています。npm cache clearそれは私のために働かなかった。

答えて

4

これは、あなたがnpm run testを実行したときにあなたが見ることができるように、それはpackage.jsonに対応するスクリプトを実行するので、このライン

"test": "echo \"Error: no test specified\" && exit 1" 

なり、それが0とは異なるステータスコードで上昇し、エラーや終了、正常です(exit 1)、これはエラーコードです。

実際にテストを実行する別の方法でテストスクリプトを変更する必要があります。

+0

私はそれを見ていただきありがとうございます。今は動作しますが、npmスクリプトを使ってwebpack-dev-serverを実行しようとしたときにエラーが発生しました...最新版がないためでしたノードとnpmのバージョン – Kirito

+1

それは可能ですが、設定上の問題でもあります。ノードのバージョンを簡単に管理するには、[nvm](https://github.com/creationix/nvm)の使用をお勧めします。それでも問題が解決しない場合は、設定に関する詳細を含む新しい質問を開きます – ThomasThiebaud

関連する問題