繁体   English   中英

Windows中的节点启动错误

[英]node start error in Windows

Windows MEVN堆栈项目我有npm start终端输出:

$ npm start

> nodejs-starter@1.0.0 start C:\final-dip\diplom-master
> SECRET=diplom nodemon index.js

"SECRET" is not internal or external
command, executable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodejs-starter@1.0.0 start: `SECRET=diplom nodemon index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-starter@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\Admin\AppData\Roaming\npm-cache\_logs\2018-05-04T10_33_19_073Z-debug.log

package.json中的代码:

{
  "name": "nodejs-starter",
  "version": "1.0.0",
  "description": "A boilerplate for NodeJS web servers",
  "main": "index.js",
  "scripts": {
    "start": "SECRET=diplom nodemon index.js",
    "init": "node ./controllers/init",
    "debug": "cross-env PORT=3333 SECRET=GREEN_BUS nodemon --inspect index.js"
  },
  "keywords": [],
  "author": "Almat Ybray",
  "license": "MIT",
  "devDependencies": {
    "eslint": "^4.14.0",
    "nodemon": "^1.14.7"
  },
  "dependencies": {
    "async": "^2.6.0",
    "body-parser": "^1.18.2",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.4",
    "express": "^4.16.2",
    "express-jwt": "^5.3.1",
    "express-validator": "^5.0.3",
    "helmet": "^3.9.0",
    "jsonwebtoken": "^8.2.0",
    "mongoose": "^5.0.0-rc1",
    "morgan": "^1.9.0",
    "multer": "^1.3.0",
    "passport": "^0.4.0",
    "passport-local": "^1.0.0",
    "socket.io": "^2.0.4"
  }
}

您缺少start脚本的cross-env 将您的package.json更改为:

{
  "scripts": {
    "start": "cross-env SECRET=diplom nodemon index.js"
  }
}

它已在debug脚本中使用。

注意它也不是依赖项的一部分,因此必须通过npm i cross-env --save

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM