首次安装博览会,初始化后立即出错

时间:2019-02-21 03:37:29

标签: javascript react-native npm expo

我正在按照此处包含的步骤进行操作 https://facebook.github.io/react-native/docs/getting-started

我已经安装了npm的新副本,甚至完成了npm update命令

然后我跑了npm install -g expo-cli

这给了很多关于未安装linux软件包但我正在运行Windows 10 Home 64bit的警告,因此那里没有问题

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-darwin-ia32@2.2.8 (node_modules\expo-cli\node_modules\@expo\ngrok-bin-darwin-ia32):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-darwin-ia32@2.2.8: wanted {"os":"darwin","arch":"ia32"} (current: {"os":"win32","arch":"x64"})

然后我输入expo init HelloWorld并出现以下错误

C:\Users\####\AppData\Roaming\npm\node_modules\expo-cli\node_modules\formidable\lib\incoming_form.js:1
(function (exports, require, module, __filename, __dirname) { �d��.�
                                                              ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
Uncaught Error C:\Users\####\AppData\Roaming\npm\node_modules\expo-cli\node_modules\formidable\lib\incoming_form.js:1
(function (exports, require, module, __filename, __dirname) { �d��.�
                                                              ^
   SyntaxError: Invalid or unexpected token
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)

我不知道为什么。它是全新安装,是否有我遗漏的安装程序?

1 个答案:

答案 0 :(得分:0)

使用npm install formidable,然后将生成的文件夹复制到expo具有其formidable副本的位置,从而解决了该问题。