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 cmnpackage.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:HBuilderProjectscmn 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.
+ create-react-app@3.0.1
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:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesansi-styles
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesescape-string-regexp
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesstrip-ansi
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulessupports-color
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_moduleschalk
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modules mp
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesenvinfo
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesfs-extra
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulessemver
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesvalidate-npm-package-nam e
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulescommander
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulescross-spawn
npm ERR! path C:UsersAdministratorAppDataRoaming
pm
ode_modulescreate-rea ct-app
ode_modulesansi-styles
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'C:UsersAdministrato rAppDataRoaming
pm
ode_modulescreate-react-app
ode_modulesansi-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:UsersAdministratorAppDataRoaming
pm-cache\_logs2019-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:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesansi-styles
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesescape-string-regexp
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesstrip-ansi
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulessupports-color
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_moduleschalk
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modules mp
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulescommander
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulescross-spawn
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesenvinfo
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesfs-extra
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulessemver
npm WARN checkPermissions Missing write access to C:UsersAdministratorAppData Roaming
pm
ode_modulescreate-react-app
ode_modulesvalidate-npm-package-nam e
npm ERR! path C:UsersAdministratorAppDataRoaming
pm
ode_modulescreate-rea ct-app
ode_modulesansi-styles
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'C:UsersAdministrato rAppDataRoaming
pm
ode_modulescreate-react-app
ode_modulesansi-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:UsersAdministratorAppDataRoaming
pm-cache\_logs2019-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:HBuilderProjectscmncmn.
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 > fsevents@2.0.6: Please update: there are crash fixes
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.6: The platform "win32" is incompatible with this module.
info "fsevents@2.0.6" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.6: 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/eslint-plugin@1.6.0" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/parser@1.6.0" has unmet peer depende ncy "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > @typescript-eslint/t ypescript-estree@1.6.0" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.10.0" 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
├─ react-dom@16.8.6
├─ react-scripts@3.0.1
└─ react@16.8.6
info All dependencies
├─ babel-preset-react-app@9.0.0
├─ eslint-config-react-app@4.0.1
├─ fork-ts-checker-webpack-plugin@1.1.1
├─ microevent.ts@0.1.1
├─ react-app-polyfill@1.0.1
├─ react-dev-utils@9.0.1
├─ react-dom@16.8.6
├─ react-error-overlay@5.1.6
├─ react-scripts@3.0.1
├─ react@16.8.6
└─ worker-rpc@0.1.1
Done in 271.09s.
Initialized a git repository.
Success! Created cmn at D:HBuilderProjectscmncmn
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