语法错误:意外的标识符:导入类型

时间:2019-09-16 00:04:52

标签: react-native react-native-tags-input

我正在开发一个应用程序,刚添加了react-native-tags-input,并且添加了TagInput后出现了以下错误:

  /Users/robavery/repositories/Spoke/node_modules/react-native-tag-input/index.js:3
  import type {
         ^^^^
  SyntaxError: Unexpected identifier
      at new Script (vm.js:74:7)
      at createScript (vm.js:246:10)
      at Object.runInThisContext (vm.js:298:10)
      at Module._compile (internal/modules/cjs/loader.js:670:28)
      at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
      at Object.require.extensions.(anonymous function) [as .js] (/Users/robavery/repositories/Spoke/node_modules/babel-register/lib/node.js:152:7)
      at Module.load (internal/modules/cjs/loader.js:612:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
      at Function.Module._load (internal/modules/cjs/loader.js:543:3)
      at Module.require (internal/modules/cjs/loader.js:650:17)
  [nodemon] app crashed - waiting for file changes before starting...

不确定import type是什么以及如何使用。这是我的package.json

{
  "name": "spoke",
  "version": "3.0.0",
  "description": "Spoke",
  "main": "src/server",
  "engines": {
    "node": ">=10.3 <11",
    "npm": "3.10.10"
  },
  "scripts": {
    "test": "jest --runInBand --forceExit --detectOpenHandles",
    "test-cache": "REDIS_FAKE=1 jest --runInBand --forceExit --detectOpenHandles",
    "test-e2e": "jest --runInBand --config jest.config.e2e.js",
    "test-sqlite": "jest --runInBand --config jest.config.sqlite.js",
    "test-coverage": "jest --coverage",
    "test-coverage-bothbackends": "jest --runInBand --config jest.config.sqlite.js -- __test__/backend.test.js &&  jest --coverage",
    "knex": "knex --knexfile ./knexfile.env.js",
    "clean": "rm -rf $OUTPUT_DIR",
    "lint": "eslint --fix --ext js --ext jsx src",
    "prod-build-client": "webpack --config ./webpack/config.js",
    "prod-build-server": "babel ./src -d ./build/server --source-maps --copy-files",
    "prod-build": "npm run clean && npm run prod-build-client && npm run prod-build-server",
    "prod-static-upload": "if [ \"$S3_STATIC_PATH\" != \"\" ] ; then s3cmd sync --acl-public --guess-mime-type ./build/client/assets/ $S3_STATIC_PATH ; fi",
    "postinstall": "if [ \"$NODE_ENV\" = production ] ; then npm run prod-build && npm run prod-static-upload && npm run notify-slack; fi",
    "notify-slack": "if [ \"$SLACK_NOTIFY_URL\" != \"\" ] ; then echo notifying slack && curl -XPOST -d '{\"channel\": \"#spoke\", \"text\":\"'\"$(whoami) building spoke $(git log -1 --pretty=%h) for $AWS_S3_BUCKET_NAME\"'\"}' $SLACK_NOTIFY_URL; fi",
    "start": "node ./build/server/server",
    "start:heroku": "BASE_URL=$(node ./build/server/heroku/print-base-url) npm start",
    "dev-message-sender-01": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/message-sender-01",
    "prod-message-sender-01": "./dev-tools/babel-run ./src/workers/message-sender-01.js",
    "dev-message-sender-234": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/message-sender-234",
    "prod-message-sender-234": "./dev-tools/babel-run ./src/workers/message-sender-234.js",
    "dev-message-sender-56": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/message-sender-56",
    "prod-message-sender-56": "./dev-tools/babel-run ./src/workers/message-sender-56.js",
    "dev-message-sender-789": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/message-sender-789",
    "prod-message-sender-789": "./dev-tools/babel-run ./src/workers/message-sender-789.js",
    "dev-job-handler": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/job-handler",
    "prod-job-handler": "./dev-tools/babel-run ./src/workers/job-handler",
    "dev-incoming-message-handler": "nodemon -e js,jsx -w ./src --exec ./dev-tools/babel-run -- ./src/workers/incoming-message-handler",
    "prod-incoming-message-handler": "./dev-tools/babel-run ./src/workers/incoming-message-handler.js",
    "predev-start": "npm run clean",
    "dev-start": "nodemon -e js,jsx,md,mustache -w ./src --exec ./dev-tools/babel-run -- ./src/server",
    "dev-start-debug": "nodemon -e js,jsx,md,mustache -w ./src --exec ./dev-tools/babel-run-debug  -- ./src/server",
    "generate-contacts": "./dev-tools/babel-run ./dev-tools/generate-contacts.js",
    "jest-test": "jest __test__/backend.test.js",
    "dev": "nf start -w --procfile ./dev-tools/Procfile.dev",
    "dev-nowrap": "nf start --trim 500 --procfile ./dev-tools/Procfile.dev --env ./__test__/e2e/.env.e2e",
    "debug-server": "nf start -w --procfile ./dev-tools/Procfile-debug-server.dev"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/MoveOnOrg/spoke.git"
  },
  "keywords": [
    "spoke",
    "sms",
    "texting",
    "campaigns",
    "campaigning",
    "politics",
    "activism",
    "organizing",
    "field"
  ],
  "author": "Axle Factory",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/MoveOnOrg/Spoke/issues"
  },
  "homepage": "https://github.com/MoveOnOrg/Spoke/#readme",
  "dependencies": {
    "aphrodite": "^0.4.1",
    "apollo-client": "^0.4.7",
    "apollo-server-express": "^1.2.0",
    "auth0-js": "^9.10.0",
    "aws-sdk": "^2.6.3",
    "aws-serverless-express": "https://registry.npmjs.org/aws-serverless-express/-/aws-serverless-express-3.0.2.tgz",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "babel-runtime": "^6.26.0",
    "body-parser": "^1.15.2",
    "camelcase-keys": "^4.1.0",
    "chart.js": "^1.1.1",
    "cookie-session": "^2.0.0-alpha.1",
    "dataloader": "^1.2.0",
    "dotenv": "^2.0.0",
    "draft-js": "^0.7.0",
    "express": "^4.14.0",
    "faker": "^3.1.0",
    "fs": "^0.0.2",
    "google-libphonenumber": "^1.0.25",
    "googleapis": "^39.2.0",
    "graphql": "^0.13.2",
    "graphql-date": "^1.0.3",
    "graphql-tag": "^0.1.9",
    "graphql-tools": "^2.8.0",
    "graphql-type-json": "^0.1.4",
    "humps": "^1.1.0",
    "is-url": "^1.2.2",
    "isomorphic-fetch": "^2.2.1",
    "jest-each": "^0.3.1",
    "json-loader": "^0.5.4",
    "knex": "^0.17.3",
    "lodash": "^4.13.1",
    "mailgun-js": "^0.16.0",
    "material-ui": "^0.20.1",
    "material-ui-color-picker": "^1.0.1",
    "material-ui-datatables": "^0.18.2",
    "minilog": "^3.0.1",
    "moment": "^2.14.1",
    "moment-timezone": "^0.5.14",
    "nexmo": "^1.0.0-beta-7",
    "nodemailer": "^4.3.1",
    "papaparse": "^4.3.6",
    "passport": "^0.3.2",
    "passport-auth0": "^0.6.1",
    "passport-local": "^1.0.0",
    "passport-local-authenticate": "^1.2.0",
    "pg": "^6.4.2",
    "prop-types": "^15.6.0",
    "query-string": "^4.1.0",
    "react": "^15.6.1",
    "react-addons-css-transition-group": "^15.2.1",
    "react-apollo": "^0.3.15",
    "react-async-script": "^0.6.0",
    "react-chartjs": "^0.7.3",
    "react-dom": "^15.6.1",
    "react-formal": "^0.18.5",
    "react-native-tag-input": "^0.0.21",
    "react-router": "^2.5.2",
    "react-router-redux": "^4.0.5",
    "react-tap-event-plugin": "^2.0.0",
    "redis": "^2.8.0",
    "redux": "^3.7.2",
    "redux-thunk": "^2.1.0",
    "request": "^2.81.0",
    "rethink-knex-adapter": "^0.4.18",
    "rollbar": "^0.6.2",
    "thinky": "^2.3.3",
    "timezonecomplete": "^5.5.0",
    "twilio": "^2.11.0",
    "uuid": "^3.1.0",
    "wait-for-expect": "^1.1.1",
    "webpack": "^3.8.1",
    "webpack-manifest-plugin": "^1.3.2",
    "yup": "^0.24.0"
  },
  "devDependencies": {
    "babel-eslint": "^6.1.2",
    "babel-jest": "^22.1.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-es2017": "^6.24.1",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-15": "^1.0.5",
    "eslint": "2.13.1",
    "eslint-config-airbnb": "^9.0.1",
    "eslint-plugin-import": "^1.10.2",
    "eslint-plugin-jsx-a11y": "^1.5.5",
    "eslint-plugin-react": "^5.2.2",
    "fakeredis": "^2.0.0",
    "foreman": "^1.4.1",
    "json2csv": "^3.6.2",
    "mockdate": "^2.0.2",
    "nodemon": "^1.9.2",
    "prettier": "1.13.6",
    "react-hot-loader": "^1.3.0",
    "react-scripts": "^2.1.3",
    "react-test-renderer": "15",
    "regenerator-runtime": "^0.10.5",
    "saucelabs": "^1.5.0",
    "selenium-webdriver": "^3.6.0",
    "sqlite3": "^4.0.0",
    "wait-on": "^2.1.0",
    "webpack-dev-server": "^2.9.4"
  }
}

什么可能导致此错误?

0 个答案:

没有答案