Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js npm5缺少构建脚本_Node.js_Npm - Fatal编程技术网

Node.js npm5缺少构建脚本

Node.js npm5缺少构建脚本,node.js,npm,Node.js,Npm,使用NPM 5,运行NPM测试: "scripts": { "build": "babel src -d dist", "test": "npm run build; mocha --require 'babel-polyfill' --compilers js:babel-register './tests/**/*.spec.js'" }, 我得到这个错误: npm ERR! missing script: build; mocha doesn't exist. '.

使用NPM 5,运行NPM测试:

"scripts": {
    "build": "babel src -d dist",
    "test": "npm run build; mocha --require 'babel-polyfill' --compilers js:babel-register './tests/**/*.spec.js'"
  },
我得到这个错误:

npm ERR! missing script: build;
mocha doesn't exist. './tests/**/*.spec.js' doesn't exist
使用NPM2没有任何问题

如果我替换npm运行构建;=>babel src-d dist,我发现了这个错误:

npm ERR! missing script: build;
mocha doesn't exist. './tests/**/*.spec.js' doesn't exist

但mocha已安装并测试文件夹exixts。

尝试检查您的错误,并创建了以下代码:

{
 ...
 "scripts": {
   "build": "echo 'building'",
   "test": "npm run build && echo 'testing'"
 },
...
}
然后我就跑,

npm test
这是我的输出:

building
testing
npm-5.0.3


所以试着在npm测试中将“;”替换为“&&”

你到底在运行什么命令?我正在运行npm测试运行npm运行构建是成功的。