javascript 如何运行从github下载的基于React/Next的代码?

mspsb9vt  于 2023-05-16  发布在  Java
关注(0)|答案(2)|浏览(141)

我从https://github.com/prgrms-web-devcourse/Team_Price_Offer_FE下载zip文件并解压缩它。
我试图运行该程序是Visual Studio Code,所以我输入了命令npm start,但它不起作用。

Team_Price_Offer_FE-devel % npm start

> start
> next start

sh: next: command not found

sh: next: command not found
Team_Price_Offer_FE-devel % next start
zsh: command not found: next

对不起,我的英语不好,我的问题可能没有挑战性;但是,我无法启动程序。
这是我用来安装的代码,也没有工作。

npm install --legacy-peer-deps
npm install node-sass@4.7.2
u5i3ibmn

u5i3ibmn1#

从Github下载zip文件夹时,还需要加载节点模块。节点模块可能非常大,因此通常不会添加到文件夹中。
要从package.json下载node模块,请执行以下操作:
运行

npm install

npm i

当node_modules成功下载后,我们可以运行我们的应用程序

npm start
zbdgwd5y

zbdgwd5y2#

首先,你需要node和一个运行在你的计算机上的包管理器,比如npm或者yarn(还有其他的)
然后,使用widh安装所有依赖项(使用npm的示例)

npm install

然后转到package.json文件,在script属性中有该项目的所有可用命令,对于这种情况:

"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "storybook": "start-storybook -p 6006",
  "build-storybook": "build-storybook",
  "lint": "eslint ./src/**/*.{js,jsx}",
  "lint:fix": "eslint --fix ./src/**/*.{js,jsx}"
},

要运行这些命令,您可以执行(npm示例)

npm run <name of the script>

样品:

npm run dev

npm run build

npm run start

等等...

相关问题