bash: create-react-app: command not found

10868 ワード

1、エラーの説明
Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ npm install create-react-app
npm WARN saveError ENOENT: no such file or directory, open 'D:\HBuilderProjects\                                cmn\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\HBuilderProjects\cmn                                \package.json'
npm WARN cmn No description
npm WARN cmn No repository field.
npm WARN cmn No README data
npm WARN cmn No license field.

+ [email protected]
added 91 packages from 45 contributors and audited 179 packages in 93.018s
found 0 vulnerabilities


Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ create-react-app wdm
bash: create-react-app: command not found

Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ npm install -g create-react-app
npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData                                \Roaming
pm
ode_modules\create-react-app
ode_modules\ansi-styles npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\escape-string-regexp npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\strip-ansi npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\supports-color npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\chalk npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\tmp npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\envinfo npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\fs-extra npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\semver npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\validate-npm-package-nam e npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\commander npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\cross-spawn npm ERR! path C:\Users\Administrator\AppData\Roaming
pm
ode_modules\create-rea ct-app
ode_modules\ansi-styles npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall access npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\Administrato r\AppData\Roaming
pm
ode_modules\create-react-app
ode_modules\ansi-styles' 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\Administrator\AppData\Roaming
pm-cache\_logs\2019-05-22T1 5_22_06_708Z-debug.log Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn $ create-react-app wdm bash: create-react-app: command not found Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn $ npm install -g create-react-app npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\ansi-styles npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\escape-string-regexp npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\strip-ansi npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\supports-color npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\chalk npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\tmp npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\commander npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\cross-spawn npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\envinfo npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\fs-extra npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\semver npm WARN checkPermissions Missing write access to C:\Users\Administrator\AppData \Roaming
pm
ode_modules\create-react-app
ode_modules\validate-npm-package-nam e npm ERR! path C:\Users\Administrator\AppData\Roaming
pm
ode_modules\create-rea ct-app
ode_modules\ansi-styles npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall access npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\Administrato r\AppData\Roaming
pm
ode_modules\create-react-app
ode_modules\ansi-styles' 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\Administrator\AppData\Roaming
pm-cache\_logs\2019-05-22T1 5_31_20_307Z-debug.log Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn $ create-react-app wdm bash: create-react-app: command not found Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn $

2、エラーの原因
create-react-appは内部コマンドではありませんが、npxコマンドを使用してインストールできます.npx create-react-app
3、解決方法
Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ cnpm install create-react-app

Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ create-react-app cmn
bash: create-react-app: command not found

Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn
$ npx create-react-app cmn

Creating a new React app in D:\HBuilderProjects\cmn\cmn.

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

yarn add v1.13.0
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
warning react-scripts > [email protected]: Please update: there are crash fixes
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check.                                 Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check.                                 Excluding it from installation.
info [email protected]: The engine "node" is incompatible with this module. Expecte                                d version "^8.16.0 || ^10.6.0 || >=11.0.0". Got "10.3.0"
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/[email protected]" has unmet peer                                 dependency "typescript@*".
warning "react-scripts > @typescript-eslint/[email protected]" has unmet peer depende                                ncy "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > @typescript-eslint/t                                [email protected]" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has                                 unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >=                                 3.4.0-dev".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 11 new dependencies.
info Direct dependencies
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 271.09s.

Initialized a git repository.

Success! Created cmn at D:\HBuilderProjects\cmn\cmn
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn 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 cmn
  yarn start

Happy hacking!

Administrator@SKY-20160824VTF MINGW64 /d/HBuilderProjects/cmn