我已经升级到最新的稳定后node和npm,我试过npm install moment --save.它package.json使用^前缀保存条目.以前,它是一个~前缀.
npm?~和之间有什么区别^?目前,如果我运行npm install,它会安装已安装软件包的更新版本.如何安装package.json文件中指定的确切版本?
我想使用以下命令创建一个 React 应用程序
npx create-react-app my-app
Run Code Online (Sandbox Code Playgroud)
但我想确保我可以选择 React 版本。我想要一个不能使用钩子的版本,所以我想强制使用16.8之前的React版本(其中发布了钩子)。
如何或在哪里找到要使用的版本?
我遵循了一个教程,该教程给了我一个类似的命令
npx create-react-app reactjs-app --scripts-version 1.1.5
Run Code Online (Sandbox Code Playgroud)
如何使用 React 版本 16.7 创建应用程序?
我的目标是获得钩子发布之前的最新版本。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: card@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR! react@"^18.0.0" from the root project
npm ERR! peer react@"\>=16.8.0" from @emotion/react@11.8.2
npm ERR! node_modules/@emotion/react
npm ERR! @emotion/react@"*" from the root project*
npm ERR! peerOptional @emotion/react@"^11.5.0" from @mui/material@5.5.3
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"" from the root project
npm ERR! 1 more (@emotion/styled)
npm ERR! 1 more (@emotion/styled)
npm ERR!
npm ERR! Could …Run Code Online (Sandbox Code Playgroud) 我需要运行一个版本 16 和 typescript 的沙箱 React 应用程序。
npx create-react-app --template=typescript blah有谁知道现在使用 React 17该怎么做?
更新
正如评论中所建议的,我尝试使用以下命令进行安装:
npm init react-app migration-calculator-npm-demo --scripts-version 3.4.4
和
npm init react-app migration-calculator-npm-demo --template typescript --scripts-version 3.4.4
3.4.4看起来像是react-scripts重大更新之前的最后一个版本。
不幸的是,我两者都出错了。
内部/模块/cjs/loader.js:1088
抛出错误;^错误:找不到模块“cra-template”
和
内部/模块/cjs/loader.js:1088
抛出错误;^错误:找不到模块“cra-template-typescript”
reactjs ×3
node.js ×2
npm ×2
command ×1
frontend ×1
javascript ×1
material-ui ×1
meteor ×1
npm-install ×1
package.json ×1
react-redux ×1
version ×1