【问题标题】:When I am trying to initialize a react project it is giving me vulnerabilities and the project is not running当我尝试初始化一个反应项目时,它给了我漏洞并且项目没有运行
【发布时间】:2021-05-26 05:53:09
【问题描述】:

当我尝试初始化一个反应项目时,它给了我漏洞并且项目没有运行。

E:\react_projects>npx create-react-app testapp-1
npx: installed 67 in 8.639s

Creating a new React app in E:\react_projects\testapp-1.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


> core-js@2.6.12 postinstall E:\react_projects\testapp-1\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.13.0 postinstall E:\react_projects\testapp-1\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.13.0 postinstall E:\react_projects\testapp-1\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall E:\react_projects\testapp-1\node_modules\ejs
> node ./postinstall.js

+ cra-template@1.1.2
+ react-dom@17.0.2
+ react-scripts@4.0.3
+ react@17.0.2
added 1907 packages from 706 contributors and audited 1910 packages in 206.323s

138 packages are looking for funding
  run `npm fund` for details

found 81 vulnerabilities (80 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Initialized a git repository.

Installing template dependencies using npm...
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @testing-library/jest-dom@5.12.0
+ @testing-library/react@11.2.7
+ web-vitals@1.1.2
+ @testing-library/user-event@12.8.3
added 29 packages from 78 contributors and audited 1939 packages in 12.653s

138 packages are looking for funding
  run `npm fund` for details

found 81 vulnerabilities (80 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Removing template package using npm...

npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

removed 1 package and audited 1938 packages in 8.97s

138 packages are looking for funding
  run `npm fund` for details

found 81 vulnerabilities (80 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Created git commit.

Success! Created testapp-1 at E:\react_projects\testapp-1
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd testapp-1
  npm start

Happy hacking!

E:\react_projects>apm start
'apm' is not recognized as an internal or external command,
operable program or batch file.

E:\react_projects>npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path E:\react_projects\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'E:\react_projects\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Daksh\AppData\Roaming\npm-cache\_logs\2021-05-26T05_38_36_900Z-debug.log

E:\react_projects>npm audit
npm ERR! code EAUDITNOPJSON
npm ERR! audit No package.json found: Cannot audit a project without a package.json

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Daksh\AppData\Roaming\npm-cache\_logs\2021-05-26T05_39_01_624Z-debug.log

【问题讨论】:

  • 你需要做cd testapp-1。一旦您进入testapp-1 目录。做 npm start 。
  • 我猜“我们建议您首先键入:cd testapp-1 npm start”的说明不够有用?您忽略了 cd 进入项目目录,并且输入了启动命令,它是 npm startapm start。投票结束为“不可复制或由错字引起”。干杯,祝你好运。

标签: reactjs npm npx


【解决方案1】:

看起来您不在项目目录中。您的项目位于 testapp-1 文件夹中,只有在此文件夹中才能找到 package.json。所以从 testapp-1 文件夹打开一个终端,然后运行npm start

【讨论】:

    猜你喜欢
    • 2020-02-28
    • 2019-09-22
    • 2019-09-23
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2020-02-15
    • 1970-01-01
    • 2016-04-10
    相关资源
    最近更新 更多