刚刚遇到这个错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: nexttwin@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from react-hook-mousetrap@2.0.4
npm ERR! node_modules/react-hook-mousetrap
npm ERR! react-hook-mousetrap@"*" from the root project
npm ERR!
Run Code Online (Sandbox Code Playgroud)
我尝试安装的模块似乎与我安装的模块具有不同的对等依赖项。似乎 npm 在这方面改变了它的行为,现在让安装失败。
我现在能做些什么来解决这个问题?我不想为此降级我的 React 版本。
我知道有一个标志被调用,--legacy-peer-deps但我不确定这到底是做什么的,是否建议使用它/潜在的缺点是什么?我认为 npm 确实让安装失败是有原因的。
这很奇怪,因为我yarn直到最近才用完,一切都很好。
我正在Mac上制作NW.js应用程序,并希望通过双击图标以开发模式运行应用程序.第一步,我正在尝试使我的shell脚本工作.
在Windows上使用VSCode(我想获得时间),我run-nw在项目的根目录创建了一个文件,其中包含:
#!/bin/bash
cd "src"
npm install
cd ..
./tools/nwjs-sdk-v0.17.3-osx-x64/nwjs.app/Contents/MacOS/nwjs "src" &
Run Code Online (Sandbox Code Playgroud)
但我得到这个输出:
$ sh ./run-nw
: command not found
: No such file or directory
: command not found
: No such file or directory
Usage: npm <command>
where <command> is one of: (snip commands list)
(snip npm help)
npm@3.10.3 /usr/local/lib/node_modules/npm
: command not found
: No such file or directory
: command not found
Run Code Online (Sandbox Code Playgroud)
我真的不明白:
\r\n用\n(以防\r造成了问题),但它改变不了什么.dirname指令),或者它可能不知道cd …在 E:\rn-starter\my-app 中创建一个新的 React 应用程序。
安装软件包。这可能需要几分钟。正在使用 cra-template 安装 React、React-dom 和 React-scripts...
“sh”不被识别为内部或外部命令、可操作程序或批处理文件。
正在中止安装。npm install --save --save-exact --loglevel 错误反应反应-dom反应脚本cra-模板失败。
正在删除生成的文件... package.json 从 E:\rn-starter 中删除 my-app/ 完成。
每当我尝试创建新的反应项目或反应本机项目时,都会弹出此错误。尝试重新安装节点并
我目前正在尝试使用create-react-app,它使用了我理解的三种不同的包,反应脚本和反应.我已经安装了create-react-app然后当我更改到目录并点击npm start时,我得到一个react-scripts:命令未找到.我遇到了很多问题.我可以看到react-scripts在我的node_modules文件夹中,但在尝试设置npm start时无法继续获取命令.我试图删除并重新安装我的所有node_modules,但仍然无法正常工作.还有谁有相同的问题吗?
? ? ? Node/toDoApp/my-test ? ? master± ? npm start
> my-test@0.1.0 start /Users/jzilch/Desktop/Web
Projects/Node:Express/Node/toDoApp/my-test
> react-scripts start
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! my-test@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-test@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
Run Code Online (Sandbox Code Playgroud) 我刚刚开始对 codepen 做出反应,我真的很喜欢它!我决定将它安装在我的 MacBook Air 上。我使用 npm 安装了 create-react-app,一切看起来都不错。然后我开始了一个项目,一切都很顺利。当我运行时npm start,出现错误:
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-app@0.1.0 start: 'react-scripts start'
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
我得出的结论是 npm 找不到 react-scripts。我已经完成了几乎所有我想出的事情:我已经更新了 npm;我已经重新安装了模块;我已经开始了一个新项目,但我仍然遇到同样的错误。我检查过,react-scripts 在我的 node_modules 文件中。我唯一没有做的是全局安装 react-scripts,但是 create-react-app …
我正在学习 Udemy 课程,我们将在其中使用create-react-app. 但是当我运行npm start和/或时yarn start,我收到错误。
这是课程:2020 年完成 React Developer(包含:Redux、Hooks、GraphQL)
\n\nnpx create-react-app test-npm (如果我使用 npm,则使用 --use-npm)
\n\n我们建议您首先输入:
\n\ncd 测试
\n npm start
快乐黑客!
\n\xe2\x9e\x9c 2020 年完成 React Developer(w:Redux、Hooks、GraphQL) cd test
\n\xe2\x9e\x9c test-npm git:(master) npm 或 yarn start
\n\n\nRun Code Online (Sandbox Code Playgroud)\ntest-npm@0.1.0 start /Users/user/Udemy/Complete React Developer in 2020 (w: Redux, Hooks, GraphQL)/test\nreact-scripts start\n
npm 结果:
\n\n\nRun Code Online (Sandbox Code Playgroud)sh: react-scripts: command not found \nnpm ERR! code ELIFECYCLE \nnpm ERR! …
我使用create-react-app生成了一个应用程序。
create-react-app myapp
Run Code Online (Sandbox Code Playgroud)
当我运行yarn start或npm start时,出现以下错误:
反应脚本开始
sh:react-scripts:找不到命令npm ERR!文件sh npm ERR!代码ELIFECYCLE npm ERR!errno ENOENT npm ERR!syscall产生npm ERR!myapp@0.1.0开始:
react-scripts startnpm错误!产生ENOENT npm ERR!npm ERR!在myapp@0.1.0启动脚本处失败。npm ERR!npm可能不是问题。上面可能还有其他日志记录输出。
当我运行npm ls反应时:
myapp@0.1.0 /Users/johnno/foosball
??? react@16.2.0
Run Code Online (Sandbox Code Playgroud)
存在react-scripts。
这是我的package.json:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"yarn": "^1.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Run Code Online (Sandbox Code Playgroud)
我试图从建议这个,但无济于事。如何解决此问题?
reactjs ×6
npm ×3
yarnpkg ×2
bash ×1
javascript ×1
macos ×1
node.js ×1
npm-install ×1
oh-my-zsh ×1
react-native ×1
sh ×1
shell ×1
windows ×1