【问题标题】:npm start breaks after package installation安装包后 npm start 中断
【发布时间】:2018-07-05 20:43:46
【问题描述】:

下面的原始问题

如果您现在使用create-react-native-app,该错误似乎已修复。它现在使用 react 0.55.2。


我们有一个正在使用 react native 构建的项目。

当我从网站运行这些命令时:

create-react-native-app AwesomeProject

然后我运行 npm start 它运行良好。

如果我更改我的包裹(我添加了这一行):

"react-native-form-builder": "^1.0.15",

然后我运行npm install,然后运行npm start,我得到这个错误:

C:\everforms>npm start

> everforms@0.1.0 start C:\everforms
> react-native-scripts start

11:57:29: Starting packager...
***ERROR STARTING PACKAGER***
No issue with doctor-npm-version
No issue with doctor-watchman-version
No issue with doctor-problem-checking-watchman-version
No issue with doctor-both-app-and-exp-json
No issue with doctor-schema-validation
No issue with doctor-validate-asset-fields
No issue with doctor-schema-validation-exception
No issue with doctor-unversioned
No issue with doctor-versions-endpoint-failed
No issue with doctor-invalid-sdk-version
No issue with doctor-node-modules-missing
No issue with doctor-react-native-not-installed

C:\everforms\node_modules\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._compile (C:\everforms\node_modules\pirates\lib\index.js:91:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (C:\everforms\node_modules\pirates\lib\index.js:96:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
11:57:35: Error starting packager: Error: Metro Bundler process exited with code 1
    at ChildProcess.<anonymous> (C:\xdl@50.5.0\src\Project.js:1215:14)
    at Generator.next (<anonymous>)
    at step (C:\everforms\node_modules\xdl\build\Project.js:1768:191)
    at C:\everforms\node_modules\xdl\build\Project.js:1768:437
    at new Promise (<anonymous>)
    at ChildProcess.<anonymous> (C:\everforms\node_modules\xdl\build\Project.js:1768:99)
    at ChildProcess.packagerProcess.once (C:\xdl@50.5.0\src\Project.js:1213:5)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! everforms@0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the everforms@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\alber\AppData\Roaming\npm-cache\_logs\2018-07-05T09_57_35_135Z-debug.log

为什么会这样?

【问题讨论】:

    标签: node.js react-native npm


    【解决方案1】:

    此错误是 react-native 0.56 中影响 Windows 用户的新错误。要解决它,您可以使用另一个 react-native 版本创建一个项目:

    react-native init --version="0.55.4" MyNewApp
    

    您可以在this GitHub issue查看更多信息。

    【讨论】:

      【解决方案2】:

      这似乎是 Windows 上 0.56 版本的 react-native 的问题。

      它在 OSX 和 Linux 上运行良好。 自 2 天以来,在 Github 上打开了一个 issue

      【讨论】:

        猜你喜欢
        • 2019-11-19
        • 2019-06-04
        • 2021-07-04
        • 1970-01-01
        • 1970-01-01
        • 2015-07-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多