如何在 Windows 10 上传递 NPM 自定义参数?

How to pass NPM custom args on Windows 10?

我正在尝试安装一个带有特殊选项的 NPM 包,它是:

PUPPETEER_PRODUCT=firefox npm install puppeteer

它在 Linux 上运行良好,但是在 windows 上运行时我得到下一个错误

PUPPETEER_PRODUCT=firefox : The term 'PUPPETEER_PRODUCT=firefox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.
At line:1 char:1

谁能帮我让它在 Windows 10 上工作

一切正常。试试这样:


    npm init
    PUPPETEER_PRODUCT=firefox npm install puppeteer@5.0.0

还有

This is an important step and the one you might run into issues in case you are working on an existing project. Delete node_modules directory if it already exists as the Firefox build is not downloaded if the puppeteer package already exists in node_modules.

也许会有帮助