ris*_*esh 11 reactjs package.json yarnpkg
给出纱线启动命令时显示的错误
错误详情:
Internal Error: confusion@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
at J.getCandidates (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:276872)
at i.getCandidates (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:266282)
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:286432 at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349928
at new Promise (<anonymous>)
at e.exports (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349910)
at o (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349611)
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349684
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349727
at new Promise (<anonymous>)
Run Code Online (Sandbox Code Playgroud)
我的 package.json 文件是
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
Run Code Online (Sandbox Code Playgroud)
我试过添加
"scripts":{
"start":"react-scripts start"
}
Run Code Online (Sandbox Code Playgroud)
但错误没有变化。
从这个问题交叉发布:
这里的问题似乎是yarn.lock工作空间之一内的现有文件。删除它就可以解决问题。
示例:3 个工作区:2 个 create-react-app ( app, home) 和 1 个共享组件:( components)
文件夹内存在component一个延迟yarn.lock文件。去掉它。
另请检查:
"private:true"各自的package.json(与name、private、相同级别source)。"workspaces"主目录的某个键中package.jsonyarn workspaces myworkspace myworkspace与您的工作区名称在其package.json. 就我而言,文件夹内工作空间的名称components称为@schon/components,因此我需要将其命名为yarn worksapces @schon/components。说明某个包没有安装,需要安装。
yarn install以安装所需的软件包。node_modules文件夹并再次运行yarn install。node_modules文件夹和yarn.lock文件并运行yarn install.| 归档时间: |
|
| 查看次数: |
1846 次 |
| 最近记录: |