node.js - : SET: command not found in `npm start`

标签 node.js reactjs npm npm-install npm-scripts

我正在尝试运行一个 react 项目。在我运行命令: 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",

关于node.js - : SET: command not found in `npm start` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55792309/

相关文章:

node.js - AWS Lambda SNS 两次发送主题

node.js - 根据条件将流量路由到多个 Node 服务器

javascript - 在 Javascript 对象中查找和替换键

node.js - npm 错误!拒绝删除/编码 EEXIST

firebase - 如何从 firebase-admin@5.12.0 更新到 firebase-admin@6.0.0?

node.js - 咕噜声不工作 : -bash: exec: grunt: not found

javascript - 如何在 electron webview 中连接到代理?

javascript - 如何在 Typescript 中将 import 语句与 import all 语句结合起来?

javascript - React-router-relay 与 Relay 模式不一致吗?

node.js - 如何在 Elastic Beanstalk 上运行 `npm update -g npm`?