问题描述
我是 NPM/Node 的新手,正在尝试运行一个看似简单的命令,但遇到了问题.
Im new to NPM/Node and am trying to run a seeingly simple command but am having trouble.
我正在使用 VS Code 并使用终端克隆 GIT 存储库.然后'npm install'.
Im using VS Code and have used the terminal to clone the GIT repo. Then 'npm install'.
我正在尝试运行文档export MAPBOX_TOKEN=YOUR_MAPBOX_API_PUBLIC_TOKEN"中的命令
I am trying to run the command in the documentation 'export MAPBOX_TOKEN=YOUR_MAPBOX_API_PUBLIC_TOKEN'
基于 NPM 页面上的说明 https://www.npmjs.com/package/mapbox-map-image-export
Based on the instructions on the NPM page https://www.npmjs.com/package/mapbox-map-image-export
为此,我输入node",然后输入上面的命令.但是我只出现了三个点?
To do this I type in 'node' then the command above. However I just get three dots appear?
推荐答案
在 Unix 系统中,export
是 Shell 内置命令,用于标记变量自动导出到后续执行的环境中命令.Windows (MS-DOS) 等效命令是 set
.
In Unix systems, export
is a Shell built-in command used to mark a variable for automatic export to the environment of subsequently executed commands. The Windows (MS-DOS) equivalent command is set
.
因此,要在 Windows 中设置 Mapbox 令牌,只需打开命令提示符并执行:
So, to set the Mapbox token in Windows, just open a command prompt and execute:
set MAPBOX_TOKEN=YOUR_MAPBOX_API_PUBLIC_TOKEN
然后您可以在同一个命令提示符会话中运行 mapbox-map-image-export,如下所示:
You can then run mapbox-map-image-export in the same command prompt session, like this:
export-map mapbox://styles/mapbox/streets-v9 -w=11in -h=8.5in -b=-7.1354,57.9095,-6.1357,58.516 -t=%MAPBOX_TOKEN% -o=lewis.png
请注意,在 Windows 中,%NAME% 用于获取变量值,因此它是 %MAPBOX_TOKEN%
(而不是 $MAPBOX_TOKEN
).
Note that in Windows, %NAME% is used to get a variable value, so it's %MAPBOX_TOKEN%
(and not $MAPBOX_TOKEN
).
你也可以直接在export-map
命令中指定Mapbox token,无需设置环境变量,例如:
You can also specify the Mapbox token directly in the export-map
command, without setting an environment variable, e.g.:
export-map mapbox://styles/mapbox/streets-v9 -w=11in -h=8.5in -b=-7.1354,57.9095,-6.1357,58.516 -t=YOUR_MAPBOX_API_PUBLIC_TOKEN -o=lewis.png
这篇关于运行 NPM mapbox-map-image-export的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!