簡體   English   中英

sh: SET: 在 `npm start` 中找不到命令

[英]sh: SET: command not found in `npm start`

我正在嘗試運行一個反應項目。 在我運行命令后: npm start ,它給了我一個錯誤:

sh: SET: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! materials-trace@0.1.0 start: `SET PORT=3100 && node scripts/start.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the materials-trace@0.1.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!     /Users/jzhu321/.npm/_logs/2019-04-22T09_29_51_770Z-debug.log

我在package.json找到了配置:

  "scripts": {
    "start": "SET PORT=3100 && node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js"
  },

我該如何解決這個問題?

Shell腳本沒有SET命令,只有: set

它應該是 :

"start": "set PORT=3100 && node scripts/start.js",

更改SETset您的代碼應該是

 "scripts": {
"start": "set PORT=3100 && node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},

去掉set命令也會報錯sh: 1: PORT: not found if there are space so you can use PORT=3100

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM