当运行babel
时,我无法再传输我的代码库。我做了。以前没有发生过这种情况,我也不知道为什么。这只发生在我拉远程主分支时,它有yarn.lock
冲突。我用yarn
命令解决了冲突。
这是我的package.json
的一部分
{
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
...
}
}
运行babel src -d build
会导致以下错误
{ Error: Cannot find module '@babel/parser'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at _parser (/Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transformation/normalize-file.js:59:16)
at parser (/Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transformation/normalize-file.js:170:18)
at normalizeFile (/Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transformation/normalize-file.js:138:11)
at runSync (/Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transformation/index.js:44:43)
at runAsync (/Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transformation/index.js:35:14)
at /Users/mohammadmohammad/Dev/work/procore/hydra_clients/budgetViewer/node_modules/@babel/core/lib/transform-file.js:58:36 code: 'MODULE_NOT_FOUND' }
我还尝试删除node_modules
并运行yarn install
,但没有成功。
4条答案
按热度按时间pxiryf3j1#
只需将
babel-eslint
从8.2,3
转换为10.0.1
即可解决此问题toiithl62#
对我来说,解决方案是删除 node_modules 文件夹,然后重新安装
oxf4rvwz3#
这就是我的工作:
yarn add -D @babel/parser
与
NPM
进行OR运算npm i -D @babel/parser
祝你好运...
uurv41yg4#
以下命令对我有效
npm审核修复--强制
请注意,审核修复程序将SemVer-major更新安装到顶级依赖项,而不仅仅是SemVer-compatible更新(https://docs.npmjs.com/cli/v7/commands/npm-audit)