npm运行构建&npm开始不起作用,对应用程序做出反应

问题描述

我是一名反应灵敏的新学生,没有别的地方可以问这个问题,也不能独自解决,因为我真的很困惑,我什至不知道如何正确地解决这个问题。我正在按照React课程中的说明进行操作。

我安装了node.js,创建了一个新的项目文件夹,然后在终端中写了create react-app .一切正常,然后分别写了npm run buildnpm start,但是都没有用

在这里显示npm run build错误消息:

> github-finder@0.1.0 build C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts build

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой,исполняемой программой или пакетным файлом.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\liana\Documents\My stuff\Webdev\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)   
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
  code: 'MODULE_NOT_FOUND',requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github-finder@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github-finder@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_07_40_371Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder> npm run build

> github-finder@0.1.0 build C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts build

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой,исполняемой программой или пакетным файлом.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\liana\Documents\My stuff\Webdev\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)   
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github-finder@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github-finder@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_10_32_763Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder>

这是npm start

代码
> github-finder@0.1.0 start C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts start

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой,requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github-finder@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github-finder@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_11_45_759Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder>

有些消息是俄语的,如果您需要翻译,请随便翻译,或者让我把翻译留在这里

感谢您阅读这篇文章,我很拼命,需要帮助,互联网上没有任何帮助

解决方法

首先根据“ create-react ...”创建项目。 您必须使用完全命令“ npx create-react-app'yournameProject'” 然后在文本编辑器(如可视代码)中打开文件夹,然后运行以下命令->“ npm start” 它不应该给你错误

关于您的问题:我认为您已采取措施

因此,请尝试先使用“ npm i”,然后再使用“ npm start”

,

我发现了一些可行的方法。 使用命令节点node node_modules/react-scripts/scripts/start.jsnpm start的功能相同,尽管我不知道这有什么用。为我工作。来源:https://github.com/facebook/create-react-app/issues/8221

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...