gpt4 book ai didi

javascript - 尝试让 package.json knex 命令起作用

转载 作者:行者123 更新时间:2023-12-01 04:01:57 27 4
gpt4 key购买 nike

我目前正在使用 someone on github 创建的 knex 项目.

我在使用 package.json 时遇到了问题,因为它看起来应该使 knex 命令易于运行:

{
"name": "database",
"version": "1.0.0",
"description": "## Steps",
"main": "index.js",
"scripts": {
"init": "knex init",
"migrate:make": "knex migrate:make",
"migrate:latest": "knex migrate:latest",
"migrate:rollback": "knex migrate:rollback",
"seed:make": "knex seed:make",
"seed:run": "knex seed:run",
"test": "tape tests.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"tape": "^4.5.1"
},
"dependencies": {
"knex": "^0.11.5",
"sqlite3": "^3.1.4"
}
}

由于某种原因,除了 npm test 之外,所有命令都不适合我。我尝试在全局范围内安装 knex(我不确定是否需要),但仍然遇到同样的问题。

这是一个示例输出:

npm seed:run

Usage: npm <command>

where <command> is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
help, help-search, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, tag, team, test, tst, un, uninstall,
unpublish, unstar, up, update, v, version, view, whoami

npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview

Specify configs in the ini-formatted file:
/root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

最佳答案

当您想要运行 scripts 中定义的脚本时 block ,您必须使用以下语法运行它:npm run <script_name> .

npm test之所以有效,是因为它是一种特殊情况,例如 npm install .

关于javascript - 尝试让 package.json knex 命令起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42119724/

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