2017-07-03 56 views
0

使用NPM 5,运行NPM测试:npm5缺失构建脚本

"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; 

使用NPM 2没有任何问题

如果我更换NPM运行构建; => babel src -d dist,我得到这个错误:

mocha doesn't exist. './tests/**/*.spec.js' doesn't exist 

但是摩卡已安装并测试文件夹exixts。

+0

你准确地运行了什么命令? –

+0

我正在运行npm test – Alvin

+0

运行npm run build成功了。 – Alvin

回答

0

尝试检查您的错误,并创造了这个代码:

{ 
... 
"scripts": { 
    "build": "echo 'building'", 
    "test": "npm run build && echo 'testing'" 
}, 
... 
} 

然后,我只是跑:

npm test 

,这是我的输出:

building 
testing 

NPM - 5.0 .3

所以试试也许repl起作用“;”与“& &”in npm test