最新消息:20210917 已从crifan.com换到crifan.org

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

npm crifan 2341浏览 0评论

折腾:

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

期间,还是先去解决:

➜  rn_rse npm start
> rn_rse@0.1.0 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 npm@4.6.1’.
***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 npm@4.6.1

结果出错:

➜  rn_rse npm i -g npm@4.6.1
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 npm@4.6.1

➜  rn_rse sudo npm i -g npm@4.6.1
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 connect@2.30.2: connect 2.x series is deprecated
> fsevents@1.1.2 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
rn_rse@0.1.0 /Users/crifan/dev/dev_root/xxx
├─┬ expo@21.0.2
│ ├─┬ @expo/vector-icons@5.2.0
│ │ └─┬ react-native-vector-icons@4.1.1
│ │   └─┬ yargs@6.6.0
│ │     ├── camelcase@3.0.0
│ │     ├── cliui@3.2.0
│ │     └─┬ yargs-parser@4.2.1
│ │       └── camelcase@3.0.0  deduped
│ ├─┬ babel-preset-expo@3.0.0
│ │ ├─┬ babel-plugin-module-resolver@2.7.1
。。。
│   ├── camelcase@3.0.0
│   ├── cliui@3.2.0
│   └─┬ yargs-parser@4.2.1
│     └── camelcase@3.0.0
└─┬ react-native-scripts@1.5.0
  └─┬ xdl@45.0.0
    └─┬ express@4.16.1
      └─┬ serve-static@1.13.1
        └── send@0.16.1
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 react-native-gesture-handler@1.0.0-alpha.22 requires a peer of react@> 15.0.0 but none was installed.
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.

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

然后再去:

npm start

就可以正常运行了:

➜  rn_rse npm start
> rn_rse@0.1.0 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 npm@4.6.1’

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
95 queries in 0.186 seconds, using 23.32MB memory