首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用create-react-native-app创建新项目时出现语法错误

使用create-react-native-app创建新项目时出现语法错误
EN

Stack Overflow用户
提问于 2020-04-22 06:59:54
回答 1查看 500关注 0票数 3

当我尝试使用create-react-native-app创建一个新项目时,我得到了一个奇怪的语法错误。任何线索都将不胜感激。谢谢

代码语言:javascript
复制
**create-react-native-app my-react-app**


/usr/local/lib/node_modules/create-react-native-app/build/index.js:2
module.exports=function(e,t){"use strict";var r={};function __webpack_require__(t){if(r[t]){return r[t].exports}var n=r[t]={i:t,l:false,exports:{}};e[t].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(2325)}t(__webpack_require__);return startup()}({4:function(e){"use strict";e.exports=eventListenerCount;function eventListenerCount(e,t){return e.listeners(t).length}},6:function(e,t,r){"use strict";const n=r(2471);const i=r(7720);class JSONStreamError extends Error{constructor(e,t){super(e.message);Error.captureStackTrace(this,t||this.constructor)}get name(){return"JSONStreamError"}set name(e){}}const s=(e,t)=>typeof e==="string"?String(t)===e:e&&typeof e.test==="function"?e.test(t):typeof e==="boolean"||typeof e==="object"?e:typeof e==="function"?e(t):false;const o=Symbol("_parser");const a=Symbol("_onValue");const c=Symbol("_onToken

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
EN

回答 1

Stack Overflow用户

发布于 2020-04-28 05:26:14

这很可能意味着您使用的是较旧版本的node或npm。通过以下方式升级到最新的npm:

sudo npm install -g npm@latest

并使用以下地址将节点升级到最新版本(来源:https://www.geeksforgeeks.org/installation-of-node-js-on-linux/):

代码语言:javascript
复制
sudo apt install python3-software-properties software-properties-common -y
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs -y
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61354610

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档