Npm缺少脚本:双赢

时间:2019-04-21 16:59:26

标签: npm npm-install npm-scripts npm-start npm-request

在执行npm run start-win之后获得以下错误日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'start-win' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose config Skipping project config: C:\Users\empacc/.npmrc. (matches userconfig)
5 verbose stack Error: missing script: start-win
5 verbose stack     at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
5 verbose stack     at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
5 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
5 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5
5 verbose stack     at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45)
5 verbose stack     at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3)
5 verbose stack     at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
5 verbose stack     at ReadFileContext.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20)
5 verbose stack     at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
5 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)
6 verbose cwd C:\Users\empacc
7 verbose Windows_NT 10.0.17134
8 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-win"
9 verbose node v10.15.3
10 verbose npm  v6.4.1
11 error missing script: start-win
12 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:1)

您是否已在start-win文件中定义了package.json脚本?

示例:


    "scripts": {
        "start-win": "node main.js"
    }