【发布时间】:2021-11-30 03:20:33
【问题描述】:
我有大量代码希望通过 gatsby-codemods 从 gatsby-image 迁移到 gatsby-plugin-image。我关注了他们的文档here。所以问题是我在我的项目中使用了 yarn 并得到了一个 `env: node\r: No such file or directory。我尝试在 vi 中解决这个问题:(我认为这是因为 yarn 在所有系统上都使用 UNIX 行尾)
cd /myPathTo/gatsby-codemods
vi index.js
:set ff=unix
:x
这是我尝试运行yarn gatsby-codemods gatsby-plugin-image时遇到的错误
Error: Command failed with exit code 127: /Users/mypath/node_modules/jscodeshift/bin/jscodeshift.js --ignore-pattern=**/node_modules/** --ignore-pattern=**/.cache/** --ignore-pattern=**/public/** --extensions=jsx,js,ts,tsx --transform /Users/mypath/gatsby-codemods/transforms/gatsby-plugin-image.js ./
at makeError (/Users/mypath/node_modules/execa/lib/error.js:60:11)
at Function.module.exports.sync (/Users/mypath/node_modules/execa/index.js:194:17)
at runTransform (/Users/mypath/node_modules/gatsby-codemods/bin/cli.js:35:33)
at Object.run (/Users/mypath/node_modules/gatsby-codemods/bin/cli.js:63:3)
at Object.<anonymous> (/Users/mypath/node_modules/gatsby-codemods/bin/gatsby-codemods.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
exitCode: 127,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
我该如何解决这个问题?
【问题讨论】:
标签: node.js gatsby yarnpkg gatsby-image