0

命令npm start & npm run build不起作用并给出以下错误消息(一些短语是俄语,如果需要,请使用翻译器):

npm start

> react-cc-try2@0.1.0 start C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\react-cc-try2
> react-scripts start

"Courses\react-cc-try2\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! react-cc-try2@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-cc-try2@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-11-28T23_50_41_165Z-debug.log

npm run build

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

"Courses\react-cc-try2\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! react-cc-try2@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-cc-try2@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-11-28T23_51_00_496Z-debug.log

我试过重新安装所有东西,创建了一个空白的反应应用程序,没有任何改变,绝对。我必须使用 node node_modules/react-scripts/scripts/start.js 才能启动我的本地服务器,它工作得很好,但这不正常,我需要一个解决方案。请帮忙。

4

1 回答 1

0

尝试将此添加到您的package.json文件中:

 "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build"

},

于 2020-11-29T17:10:47.977 回答