0

想要在项目目录中运行流星,但 npm 没有正确安装在目录中。npm 安装后脚本中有一些错误。我的项目基于 Linux,但由于问题我必须从 Windows 运行服务器。React Native 支持前端,MongoDB 支持后端。每次我尝试在项目目录中安装 npm 时,它都会显示以下错误。

Running npm-postinstall.js
child_process.js:669
    throw err;
    ^

Error: Command failed: copy node_modules/katex/dist/katex.min.css app/katex/
    at checkExecSyncError (child_process.js:630:11)
    at execSync (child_process.js:666:15)
    at Object.<anonymous> (D:\Project\Server\.scripts\npm-postinstall.js:6:1)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer 54 68 65 20 73 79 6e 74 61 78 20 6f 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 69 73 20 69 6e 63 6f 72 72 65 63 74 2e 0d 0a>,
    <Buffer >
  ],
  pid: 820,
  stdout: <Buffer 54 68 65 20 73 79 6e 74 61 78 20 6f 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 69 73 20 69 6e 63 6f 72 72 65 63 74 2e 0d 0a>,
  stderr: <Buffer >
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Rocket.Chat@3.3.0-develop postinstall: `node .scripts/npm-postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Rocket.Chat@3.3.0-develop postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
4

1 回答 1

2

看起来它在安装后脚本上失败了。有关如何禁用它的一些想法,请参阅此响应。npm:禁用包的安装后脚本

否则,您可以尝试使用 yarn,因为它不会执行安装后脚本。它也运行得更快一些。只要你的节点版本与流星节点版本匹配,使用yarn应该是安全的

于 2020-05-26T08:45:08.140 回答