gpt4 book ai didi

javascript - `npm run jshint` 结果为 `missing script: jshint`

转载 作者:行者123 更新时间:2023-11-29 15:25:56 25 4
gpt4 key购买 nike

我正在尝试 jshint 一些 javascript 文件,但由于某种原因,jshint 的本地 npm 安装无法正常工作。

包在那里:

$ npm list --depth=0
testapp@1.0.0 /Users/me/workspace/testapp
└── jshint@2.9.3

我得到的错误如下:

$ 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 documentation npm runnpm run-script 的别名,运行 package.json 文件中的 scripts 之一.如果您将 jshint 脚本条目添加到您的 package.json,它应该运行您本地安装的 jshint:

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

关于javascript - `npm run jshint` 结果为 `missing script: jshint`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39116249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com