简体   繁体   中英

Unable to create react project

System throws unexpected token error when npx creat-react-app is executed.

Node version:16.15.0

C:\Users\HammadAli\Desktop\Course Work>npx create-react-app app
C:\Users\HammadAli\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\index.js:54
const { init } = require('./createReactApp');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

Try to downgrade npm version. I had this same, on 16.14.0. I recommend nvm for changing node version. For example: nvm install 14.18.1 nvm use 14.18.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM