I recently migrated my operating system to Linux Mint Cinnamon Edge. I installed NodeJS and npm normally and the installation worked. However, when I start some projects with npx it doesn’t work and presents different errors. I discovered the error after trying to continue a React-Native application I was running on Windows. ‘npm install’ worked normally, but when I went to test the project ‘npx expo start –clear’ did not work
npx create-expo-app
Error:
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
npx create-next-app@latest
Error:
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'stream/promises'
Require stack:
- /home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Module.8776 (/home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:74:30476)
at __nccwpck_require__ (/home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:74:59347)
at /home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:74:60211
at Object.<anonymous> (/home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js:74:60255)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/thiago/.npm/_npx/cc2145a2fe1558fa/node_modules/create-next-app/dist/index.js'
]
}
node -v
v12.22.9
npm -v
8.5.1
I would like to know if there are any steps that need to be done in Linux so that React applications work normally.
thiagohip is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.