描述: 上代码

var ps = require('child_process').spawn("npm", ['install'], {
stdio: 'inherit',
cwd: srcPath
}); ps.on('error', function(err) {
console.log(err);
}); ps.on('exit', function (err) {
console.log('exit');
});

执行报[Error: spawn ENOENT]

原因,windows下npm执行名不同

解决方案

var ps = require('child_process').spawn(process.platform === "win32" ? "npm.cmd" : "npm", ['install'], {
stdio: 'inherit',
cwd: srcPath
});

参考:http://stackoverflow.com/questions/17516772/using-nodejss-spawn-causes-unknown-option-and-error-spawn-enoent-err

nodejs在spawn中执行npm报错 [Error: spawn ENOENT]” errors的更多相关文章

  1. php源码安装执行configure报错error: off_t undefined; check your library configuration

    php安装执行configure报错error: off_t undefined; check your library configuration vim /etc/ld.so.conf 添加如下几 ...

  2. 解决上一篇bean.xml中<bean>标签报错“ Error while downloading 'http://www.springframework.org/schema/beans/spring-beans.xsd........”

    在xml文件中,头部报错如题 一开始查询,说是头部少了“<?xml version="1.0" encoding="UTF-8"?>”,但是我并没有 ...

  3. django中执行py报错Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured

    https://blog.csdn.net/heybob/article/details/49684261 django代码下面直接run的时候报错: django.core.exceptions.I ...

  4. Eclipse中mvn install 报错error in opening zip file

    报错信息 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (de ...

  5. java数据库执行迁移报错Error creating bean with name 'flywayInitializer' defined in class path resource

    报错原因 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayI ...

  6. Idea中执行TestNg报错

    今天在Idea中使用TestNg过程中报错: java.lang.AbstractMethodError: org.testng.remote.RemoteTestNG$DelegatingTestR ...

  7. node 中 npm报错 Error: ENOENT, stat 'C:\Users\Administrator\AppData\Roaming\npm'

    今天在看node书本时,安装express,看看里面的包.没想到出现这样一种情况. 报错了.后来思考了一下,可能是修改了node的默认安装路径.于是准备在出错的路径下建一个npm文件夹. 注意,有个时 ...

  8. npm报错Error: ENOENT, stat 'D:\NodeLearn\node-global'

    最近想试下当前的当红炸子鸡 Nodejs,在安装配置时,发生了下面的错误: C:\nodejs\npmjs\bin>cd .. C:\nodejs\npmjs>cd .. C:\nodej ...

  9. 使用Linux调用资源库中的Job报错-ERROR: No repository provided, can't load job.

    使用kettle调用资源库中的作业或者是转换,需要注意一下两个问题: 问题一:(-rep后不需要IP)标准shell代码如下 #!/bin/bash export JAVA_HOME=/usr/lib ...

随机推荐

  1. linux中crontab的使用方法

    crontab参数说明: -e : 执行文字编辑器来设定时程表,内定的文字编辑器是 VI,如果你想用别的文字编辑器,则请先设定 VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv V ...

  2. (转)linux进程 linux线程 信息查看 ps top pstree

    原文:https://blog.csdn.net/xiaoliuliu2050/article/details/81912202 https://blog.csdn.net/u011734144/ar ...

  3. .net core Jenkins持续集成Linux、Docker、K8S

    jenkins插件 系统管理 -> 管理插件,安装如下插件. #如果搜索不到去掉Plugin在搜索 GitLab Plugin Gitlab Hook Plugin #使用Gitlab账号做用户 ...

  4. Create and Embed an Application Manifest (UAC)

    http://msdn.microsoft.com/en-us/library/bb756929.aspx 可以在VS2008中设置当执行exe时弹出提升管理员权限对话框:xx Property-&g ...

  5. interface21 - web - DispatcherServlet(DispatcherServlet初始化流程)

    前言 最近打算花点时间好好看看spring的源码,然而现在Spring的源码经过迭代的版本太多了,比较庞大,看起来比较累,所以准备从最初的版本(interface21)开始入手,仅用于学习,理解其设计 ...

  6. 一款Timer倒计时器

    http://files.cnblogs.com/Alandre/Time.zip自己做的哦 欢迎关注

  7. 深入学习卷积神经网络(CNN)的原理知识

    网上关于卷积神经网络的相关知识以及数不胜数,所以本文在学习了前人的博客和知乎,在别人博客的基础上整理的知识点,便于自己理解,以后复习也可以常看看,但是如果侵犯到哪位大神的权利,请联系小编,谢谢.好了下 ...

  8. 在Android项目中使用AspectJ

    版权声明:本文为博主原创文章,未经博主允许不得转载. 转载请表明出处:http://www.cnblogs.com/cavalier-/p/8888459.html 什么是AOP AOP是 Aspec ...

  9. 软工网络16个人作业2——WordCount

    Deadline: 2018-9-17 22:00PM,以博客提交至班级博客时间为准 要求参考来自:https://www.cnblogs.com/xinz/archive/2011/11/27/22 ...

  10. SpringBoot自动配置注解原理解析

    1. SpringBoot启动主程序类: @SpringBootApplication public class DemoApplication { public static void main(S ...