提问者:小点点

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


我正在尝试安装一个带有特殊选项的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

有谁能帮我把它用在Windows10上吗


共1个答案

匿名用户

一切正常。这样试试:


    npm init
    PUPPETEER_PRODUCT=firefox npm install puppeteer@5.0.0

而且还

这是一个重要的步骤,如果您正在处理一个现有的项目,您可能会遇到一些问题。如果node_modules目录已经存在,则删除它,因为如果node_modules中已经存在puppeteer包,则未下载Firefox构建。

也许会有帮助