最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Error: You are using npm version 5.0.0. We recommend version 4.6.1. To install it, run ‘npm i -g [email protected]

npm crifan 2604浏览 0评论

折腾:

【已解决】npm start出错:react-native-scripts: command not found

期间,还是先去解决:

➜  rn_rse npm start
> [email protected] start /Users/crifan/dev/dev_root/xxx
> react-native-scripts start
17:16:38: Starting packager…
***ERROR STARTING PACKAGER***
Error: You are using npm version 5.0.0. We recommend version 4.6.1. To install it, run ‘npm i -g [email protected]’.
***ERROR STARTING PACKAGER***

中的npm的版问题吧。

Error: You are using npm version 5.0.0. We recommend version 4.6.1.

Error: You are using npm version 5.0.3. Please use an npm version that is >= 3.0.0 and < 5.0.0. · Issue #277 · react-community/create-react-native-app

react-native-cli is not compatible with npm@5 · Issue #14767 · facebook/react-native

Hard Error on npm >5 · Issue #275 · react-community/create-react-native-app

算了,还是去安装提示去:

npm i -g [email protected]

结果出错:

➜  rn_rse npm i -g [email protected]
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/aproba
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/debuglog
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match
。。。
/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/node_modules/ms
npm WARN checkPermissions Missing write access to 
。。。
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/tar-fs/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/tar-fs/node_modules/pump/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/tar-stream/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/node_modules
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/aproba
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/npm/node_modules/aproba’
npm ERR!  { Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules/npm/node_modules/aproba’
npm ERR!   errno: -13,
npm ERR!   code: ‘EACCES’,
npm ERR!   syscall: ‘access’,
npm ERR!   path: ‘/usr/local/lib/node_modules/npm/node_modules/aproba’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/crifan/.npm/_logs/2017-10-09T09_24_31_077Z-debug.log

去加上sudo试试:

sudo npm i -g [email protected]

➜  rn_rse sudo npm i -g [email protected]
Password:
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
added 9 packages, removed 146 packages and updated 287 packages in 13.118s

然后接着去试试:

npm install

➜  rn_rse npm install
npm WARN deprecated [email protected]: connect 2.x series is deprecated
> [email protected] install /Users/crifan/dev/dev_root/xxx/node_modules/fsevents
> node install
[fsevents] Success: "/Users/crifan/dev/dev_root/xxx/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass –update-binary to reinstall or –build-from-source to recompile
[email protected] /Users/crifan/dev/dev_root/xxx
│ ├─┬ @expo/[email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     ├── [email protected]
│ │     ├── [email protected]
│ │     └─┬ [email protected]
│ │       └── [email protected]  deduped
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
。。。
│   ├── [email protected]
│   ├── [email protected]
│   └─┬ [email protected]
│     └── [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected]
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxx
。。。
‘/Users/crifan/dev/dev_root/daryun/Projects/xxx/node_modules/node-pre-gyp/node_modules/request/package.json’
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.

一堆的警告,先不去管了。

然后再去:

npm start

就可以正常运行了:

➜  rn_rse npm start
> [email protected] start /Users/crifan/dev/dev_root/xxx
> react-native-scripts start
17:29:08: Starting packager…
Packager started!
To view your app with live reloading, point the Expo app to this QR code.
You’ll find the QR scanner on the Projects tab of the app.
。。。
Or enter this address in the Expo app’s search bar:
  exp://192.168.0.118:19000
Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit https://expo.io.
Logs from serving your app will appear here. Press Ctrl+C at any time to stop.
› Press a to open Android device or emulator, or i to open iOS emulator.
› Press q to display QR code.
› Press r to restart packager, or R to restart packager and clear cache.
› Press d to toggle development mode. (current mode: development)

转载请注明:在路上 » 【已解决】Error: You are using npm version 5.0.0. We recommend version 4.6.1. To install it, run ‘npm i -g [email protected]

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
85 queries in 0.165 seconds, using 22.09MB memory