当节点在路径中时,npm install抱怨“节点”未被识别为内部或外部命令

时间:2019-02-05 20:48:39

标签: node.js node-sass

我现在正在执行Jenkins构建,但是在执行“ npm install”的某个时刻,我收到一条错误消息,提示“无法将'node'识别为内部或外部命令,可操作程序或批处理文件。”但是,我的路径中确实有节点,并且已经验证了这一点,但是在npm安装之前进行了“ where node”操作。

“ where node”和“ npm install”都位于我的Jenkins作业的同一“执行Windows批处理命令”部分中。

我读了一些帖子。有时会因为不正确处理路径内的空格而遇到此错误。我的路径上没有空间。

在构建环境中,我也无法方便地访问计算机。我只能尝试Jenkins的Execute Windows批处理命令。

下面是我的生成日志,其中包含错误消息。

npm install 
14:48:56 npm WARN deprecated ng2-bootstrap@1.6.3: ng2-bootstrap is renamed to ngx-bootstrap, please do npm i ngx-bootstrap -S
14:48:57 npm WARN deprecated hapi@13.5.3: This version is no longer maintained. Please upgrade to the latest version of the framework.
14:48:58 npm WARN deprecated gulp-util@3.0.7: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
14:48:59 npm WARN deprecated joi@8.1.1: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated joi@10.6.0: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated boom@3.2.2: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated joi@8.4.2: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated call@3.0.4: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated kilt@2.0.2: This module is no longer maintained.
14:48:59 npm WARN deprecated hoek@3.0.4: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated peekaboo@2.0.2: This module is no longer maintained.
14:48:59 npm WARN deprecated statehood@4.1.0: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated subtext@4.4.1: This version is no longer maintained. Please upgrade to the latest version.
14:48:59 npm WARN deprecated fast-safe-stringify@1.0.9: use 1.1.0+ see https://github.com/davidmarkclements/fast-safe-stringify/issues/4
14:48:59 npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
14:49:00 npm WARN deprecated boom@4.3.1: This version is no longer maintained. Please upgrade to the latest version.
14:49:00 npm WARN deprecated joi@9.2.0: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated boom@3.2.0: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated call@3.0.2: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated joi@8.1.0: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated kilt@2.0.1: This module is no longer maintained.
14:49:05 npm WARN deprecated peekaboo@2.0.1: This module is no longer maintained.
14:49:05 npm WARN deprecated statehood@4.0.1: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated subtext@4.0.3: This version is no longer maintained. Please upgrade to the latest version.
14:49:05 npm WARN deprecated wreck@7.2.1: This version is no longer maintained. Please upgrade to the latest version.
14:55:08 
14:55:08 > node-sass@4.5.3 install F:\JENKINS-SLAVE\workspace\some_appcode\jenkins_job_code\app_folder\node_modules\node-sass
14:55:08 > node scripts/install.js
14:55:08 
14:55:08 'node' is not recognized as an internal or external command,
14:55:08 operable program or batch file.

2 个答案:

答案 0 :(得分:1)

在控制面板->系统->高级系统设置下,将nodejs新系统变量添加到您的PC中

$sorc451sql = "Select * FROM table1 ORDER BY audDt";
while ($sorc451row = mysqli_fetch_array($sorc451res)) {
    $sorc451arycust[$i][6]  = $sorc451row['gropID'];


    $sorc452sql = "Select * FROM table2 WHERE gropID=".$sorc451arycust[$i][6];
    while ($sorc452row = mysqli_fetch_array($sorc452res)) {
        $sorc452arycust[$i][12]  = $sorc452row['siteSt'];
    }
}

之后,重新运行命令:

;C:\Program Files\nodejs\

答案 1 :(得分:0)

实际的解决方案是清除Jenkins VM的缓存,然后它将起作用。这是詹金斯(Jenkins)的缓存问题。