描述: 上代码

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. oracle中常见的对表、表空间和视图的操作

    创建表:create table t1(key1 type default 0,key2 type not null) 删除表:drop table t1; 删除表数据:truncate table ...

  2. 获取CPU ID--查看CPU数量/核数

    Ubuntu 获取CPU序列号或者主板序列号 CPU ID 代码: sudo dmidecode -t 4 | grep ID ID: 54 06 05 00 FF FB 8B 0F 主板序列号 代码 ...

  3. 001. Asp.Net Routing与MVC 之(基础知识):URL

    URL(Uniform Resoure Locator:统一资源定位器)是WWW页的绝对地址.URL地址格式排列为:scheme://host:port/path. 例如 http://www.zn. ...

  4. SpringCloud断路器监控面板——Hystrix Dashboard

    一.简介 Hystrix Dashboard是Hystrix的一个组件,Hystrix Dashboard提供一个断路器的监控面板,可以使我们更好的监控服务和集群的状态,仅仅使用Hystrix Das ...

  5. Angular2入门:TypeScript的函数 - 函数定义、可选参数、默认参数和函数重载

  6. 【学习笔记】JS经典异步操作,从闭包到async/await

    参考文献:王仕军——知乎专栏前端周刊 感谢作者的热心总结,本文在理解的基础上,根据自己能力水平作了一点小小的修改,在加深自己印象的同时也希望能和各位共同进步... 1. 异步与for循环 抛出一个问题 ...

  7. Spark SQL结构化数据处理

    Spark SQL是Spark框架的重要组成部分, 主要用于结构化数据处理和对Spark数据执行类SQL的查询. DataFrame是一个分布式的,按照命名列的形式组织的数据集合. 一张SQL数据表可 ...

  8. Hyperledger Fabric密码模块系列之BCCSP(四)

    前面说过要找时间介绍一下bccsp包下面的工厂factory,so here it is. 通过factory目前可以获得两类BCCSP实例,一个是上文说的sw,还有一个是通过pkcs11实现的. B ...

  9. Badge

    The following plugin provides functionality available through Pipeline-compatible steps. Read more a ...

  10. C# 线程间互相通信 AutoResetEvent和ManualResetEvent

    C#线程间互相通信主要用到两个类:AutoResetEvent和ManualResetEvent. 一.AutoResetEvent AutoResetEvent 允许线程通过发信号互相通信,线程通过 ...