为什么我的 babel-chaining (&&) 不起作用?

Why does my babel-chaining (&&) does not work?

我正在使用 React/Express/Firebase 编写有关服务器端渲染的教程。

本教程创建于 2017 年,不幸的是,我在 babel 的脚本部分遇到了困难,我在其中尝试链接一些命令。 请注意,每个命令本身都可以正常工作,但将它们链接起来会导致以下错误:

**Der Befehl "node_modules" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! nonssr@1.0.0 babel: babel src -d functions/src && node_modules/.bin/babel index.js -d functions

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the nonssr@1.0.0 babel 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\Thorsten\AppData\Roaming\npm-cache_logs20-03-16T08_46_28_887Z-debug.log**

脚本命令如下:

  "scripts": {
    "babel": "node_modules/.bin/babel src -d functions/src && node_modules/.bin/babel index.js -d functions"
  },

这行代码有没有普遍性的错误? 您需要额外的代码来分析错误吗?

此致!

我自己找到了解决方案,但也许有人可以解释为什么会这样。

此代码有效:

  "scripts": {
    "babel": "node_modules/.bin/babel src -d functions/src && babel index.js -d functions"
  },

我不得不删除第二个 "node_modules/.bin/babel ...",只需输入 "babel ..."