2017-07-03 55 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