2016-08-24 3 views
2

jshint에서 몇 가지 javascript 파일을 만들려고하고 있는데 어떤 이유로 jshint의 로컬 npm 설치가 작동하지 않습니다.`npm run jshint` 결과가`missing script : jshint`의 결과입니다.

패키지가있다 :

$ npm list --depth=0 
[email protected] /Users/me/workspace/testapp 
└── [email protected] 

그리고 내가 오류는 다음

$ npm run jshint 
npm ERR! Darwin 15.4.0 
npm ERR! argv "/usr/local/Cellar/node/5.6.0/bin/node" "/usr/local/bin/npm" "run" "jshint" 
npm ERR! node v5.6.0 
npm ERR! npm v3.6.0 

npm ERR! missing script: jshint 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <https://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/me/workspace/testapp/npm-debug.log 

내가 설치 전역으로이 문제를 해결할 수 있지만, 나는 그것을 선호 것 현지에서 일하고 있습니다. the documentationnpm run에 따르면

+0

당신이'sudo는 대한 Chown -R $ (whoami를) "의 $ HOME/.npm"를 실행 해보세요 수'당신 전에 'npm run jshint'를 실행합니다. –

답변

1

npm run-script의 별칭이며, package.json 파일에 scripts 중 하나를 실행합니다. 당신이 당신의 package.jsonjshint 스크립트 항목을 추가하면 실행해야합니다 귀하의 jshint을 로컬로 설치된 :

{ 
    "name": ..., 
    "version": ..., 
    "scripts": { 
     "jshint": "jshint" 
    } 
}