【问题标题】:Jenkins npm install not creating node_modules folderJenkins npm install 没有创建 node_modules 文件夹
【发布时间】:2019-01-09 22:58:16
【问题描述】:

我已经在我们的 Jenkins 服务器上创建了一个工作来使用 Gulp 构建一个 NodeJS 应用程序。它从bitbucket repo中提取没有任何问题,但是当在Execute Windows批处理命令中运行“npm install”时,它不会安装依赖项并且没有创建node_modules文件夹,如果我尝试运行gulp它会抱怨gulp 没有在本地安装。下面是运行 Jenkins 作业时看到的输出。

C:\Jenkins\workspace\DCC Map>npm install 
audited 7781 packages in 5.271s
found 12 vulnerabilities (3 low, 9 high)
  run `npm audit fix` to fix them, or `npm audit` for details
[DCC Map] $ cmd /c call C:\Windows\TEMP\jenkins5832751157703772279.bat
C:\Jenkins\workspace\DCC Map>gulp
[[90m17:49:07[39m] Local gulp not found in C:\Jenkins\workspace\DCC Map
[[90m17:49:07[39m] Try running: npm install gulp
Build step 'Execute Windows batch command' marked build as failure
Checking console output
Finished: FAILURE

如果我从命令提示符进入文件夹并运行 npm install 命令,则依赖项已正确安装。我注意到的是,在 Jenkins 输出中它显示“在 5.271 秒内审核了 7781 个包”,而当我从命令提示符运行它时,它显示“添加了来自 251 个贡献者的 484 个包并在 31.593 秒内审核了 7781 个包”。

任何帮助将不胜感激。

【问题讨论】:

    标签: jenkins npm-install


    【解决方案1】:

    在这里找到答案:https://github.com/npm/npm/issues/6803

    基本上,如果 NODE_ENV 设置为“生产”,npm install 会忽略开发依赖项。解决此问题的一种方法是使用 --production=false 执行 npm install。

    【讨论】:

      猜你喜欢
      • 2016-10-29
      • 2022-01-15
      • 2019-01-13
      • 1970-01-01
      • 2016-11-23
      • 2021-11-09
      • 2019-02-07
      • 1970-01-01
      • 2020-07-25
      相关资源
      最近更新 更多