npx on windows 10 with nvm causes need to install following packages
npx on windows 10 with nvm causes need to install following packages
我已经安装了 nvm for windows 并且 nvm 列表显示
17.2.0
* 16.13.1 (Currently using 64-bit executable)
14.5.0
10.21.0
8.12.0
如果我 运行 npx -v
我得到 8.1.2
但如果我 运行 说 npx create-next-app@latest --ts
那么我得到
Need to install the following packages:
create-next-app@latest
Ok to proceed? (y)
如果我通过说 nvm use 14.5.0
切换到 14.5.0 然后 运行 npx -v
我得到 6.14.0
& 如果我然后 运行 说 npx create-next-app@latest --ts
然后我得到
的预期输出
npx: installed 1 in 1.772s
? What is your project named? » my-app
使用 nvm use 17.2.0,行为类似于 nvm use 16.13.1。对于 17.2.0,运行ning npx -v
输出 8.1.4
对于 nvm use 10.21.0 和 8.12.0,npx 可以按预期工作,而不会要求我全局下载 create-next-app,就像它对高于 14.5.0 的节点版本所做的那样。
14.5.0 及更低版本的另一件事,如果我这样做 npx --help
我得到
Execute binaries from npm packages.
npx [options] <command>[@version] [command-arg]...
npx [options] [-p|--package <package>]... <command> [command-arg]...
npx [options] -c '<command-string>'
npx --shell-auto-fallback [shell]
Options:
--package, -p Package to be installed. [string]
--cache Location of the npm cache. [string]
--always-spawn Always spawn a child process to execute the command.
[boolean]
--no-install Skip installation if a package is missing. [boolean]
--userconfig Path to user npmrc. [string]
--call, -c Execute string as if inside `npm run-script`. [string]
--shell, -s Shell to execute the command with, if any.
[string] [default: false]
--shell-auto-fallback Generate shell code to use npx as the "command not
found" fallback.
[string] [choices: "", "bash", "fish", "zsh"]
--ignore-existing Ignores existing binaries in $PATH, or in the local
project. This forces npx to do a temporary install and
use the latest version. [boolean]
--quiet, -q Suppress output from npx itself. Subcommands will not
be affected. [boolean]
--npm npm binary to use for internal operations.
[string] [default:
"C:\Users\Sangeet\AppData\Roaming\nvm\v14.5.0\node_modules\npm\bin\npm-cli.js"
]
--node-arg, -n Extra node argument when calling a node binary.[string]
--version, -v Show version number [boolean]
--help, -h Show help [boolean]
For the full documentation, see the manual page for npx(1).
但是 16.13.1 和更高的说法 npx --help
给了我
npm exec
Run a command from a local or remote npm package
Usage:
npm exec -- <pkg>[@<version>] [args...]
npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
npm exec -c '<cmd> [args...]'
npm exec --package=foo -c '<cmd> [args...]'
Options:
[--package <pkg>[@<version>] [--package <pkg>[@<version>] ...]]
[-c|--call <call>]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
alias: x
Run "npm help exec" for more info
我假设 npx 与 npm 一起“预安装”,因此切换到高于 5.2.0 的任何 npm 版本应该使 npx 可用。
我当然可以 nvm use 14.5.0
继续我的工作,但我很好奇为什么 npx 在 16.3.1 和 17.2.0 上不正常。除非我没有做错什么。
显然这是 npx 根据 github issue
表现的新方式
似乎是 @jcollum ran across the very same issue per Whosebug 问题。
我已经安装了 nvm for windows 并且 nvm 列表显示
17.2.0
* 16.13.1 (Currently using 64-bit executable)
14.5.0
10.21.0
8.12.0
如果我 运行 npx -v
我得到 8.1.2
但如果我 运行 说 npx create-next-app@latest --ts
那么我得到
Need to install the following packages:
create-next-app@latest
Ok to proceed? (y)
如果我通过说 nvm use 14.5.0
切换到 14.5.0 然后 运行 npx -v
我得到 6.14.0
& 如果我然后 运行 说 npx create-next-app@latest --ts
然后我得到
npx: installed 1 in 1.772s
? What is your project named? » my-app
使用 nvm use 17.2.0,行为类似于 nvm use 16.13.1。对于 17.2.0,运行ning npx -v
输出 8.1.4
对于 nvm use 10.21.0 和 8.12.0,npx 可以按预期工作,而不会要求我全局下载 create-next-app,就像它对高于 14.5.0 的节点版本所做的那样。
14.5.0 及更低版本的另一件事,如果我这样做 npx --help
我得到
Execute binaries from npm packages.
npx [options] <command>[@version] [command-arg]...
npx [options] [-p|--package <package>]... <command> [command-arg]...
npx [options] -c '<command-string>'
npx --shell-auto-fallback [shell]
Options:
--package, -p Package to be installed. [string]
--cache Location of the npm cache. [string]
--always-spawn Always spawn a child process to execute the command.
[boolean]
--no-install Skip installation if a package is missing. [boolean]
--userconfig Path to user npmrc. [string]
--call, -c Execute string as if inside `npm run-script`. [string]
--shell, -s Shell to execute the command with, if any.
[string] [default: false]
--shell-auto-fallback Generate shell code to use npx as the "command not
found" fallback.
[string] [choices: "", "bash", "fish", "zsh"]
--ignore-existing Ignores existing binaries in $PATH, or in the local
project. This forces npx to do a temporary install and
use the latest version. [boolean]
--quiet, -q Suppress output from npx itself. Subcommands will not
be affected. [boolean]
--npm npm binary to use for internal operations.
[string] [default:
"C:\Users\Sangeet\AppData\Roaming\nvm\v14.5.0\node_modules\npm\bin\npm-cli.js"
]
--node-arg, -n Extra node argument when calling a node binary.[string]
--version, -v Show version number [boolean]
--help, -h Show help [boolean]
For the full documentation, see the manual page for npx(1).
但是 16.13.1 和更高的说法 npx --help
给了我
npm exec
Run a command from a local or remote npm package
Usage:
npm exec -- <pkg>[@<version>] [args...]
npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
npm exec -c '<cmd> [args...]'
npm exec --package=foo -c '<cmd> [args...]'
Options:
[--package <pkg>[@<version>] [--package <pkg>[@<version>] ...]]
[-c|--call <call>]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
alias: x
Run "npm help exec" for more info
我假设 npx 与 npm 一起“预安装”,因此切换到高于 5.2.0 的任何 npm 版本应该使 npx 可用。
我当然可以 nvm use 14.5.0
继续我的工作,但我很好奇为什么 npx 在 16.3.1 和 17.2.0 上不正常。除非我没有做错什么。
显然这是 npx 根据 github issue
表现的新方式似乎是 @jcollum ran across the very same issue per