“。”不是命令还是蝙蝠尝试服务项目时

时间:2018-11-16 08:04:08

标签: node.js windows cmd

所以我目前正在使用nodeJS在Win 10机器上的项目上进行构建/工作

但是我在运行时遇到了问题。它说以下。

C:\Users\myuser\Documents\Gits\deon>npm start

> deon@1.0.0 start C:\Users\myuser\Documents\Gits\deon
> ./scripts/serve

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! deon@1.0.0 start: `./scripts/serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the deon@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Melonendk\AppData\Roaming\npm-cache\_logs\2018-11-16T08_00_31_347Z-debug.log

我试图检查Windows上的系统环境,就像许多其他人在互联网上发布的一样,但是没有运气:(

如何解决此问题?

Package.json

{
  "name": "deon",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "start": "./scripts/serve",
    "start-prod": "./scripts/serve-bin",
    "build": "./scripts/build",
    "test": "echo \"Not implemented.\" && exit 1"
  },
  "author": "",
  "contributors": [],
  "license": "ISC",
  "dependencies": {},
  "devDependencies": {
    "eslint": "^4.18.1"
  }
}

我的服务文件。

#!/usr/bin/env bash
set -e

SRC=$PWD/src
HTML=$SRC/html
TEMPLATES=$(find "$SRC/templates" -iname '*.html')

web-build $HTML/begin.html \
  $HTML/${1:-development}.html \
    $HTML/head.html \
    $HTML/begin-body.html \
    $HTML/body.html \
    $TEMPLATES \
    $HTML/end.html \
    serve -m -v --static $SRC --port ${2:-8080}

2 个答案:

答案 0 :(得分:0)

正如乔纳森·乔纳森(Jonathan Jonathan)在评论中提到的那样,您需要尝试一下

"start": "node ./scripts/server,js"

或尝试类似的事情

 "start": "cd scripts && node server.js"

答案 1 :(得分:0)

“开始”:“。\ scripts \ serve”将其更改为

"start": "node ./scripts/serve"