I´m getting an error using yarn to create a nextJS app, i just run:
yarn create next-app --typescript
then just run:
yarn dev
usually this error is showed:
yarn dev
yarn run v1.22.17
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module 'styled-jsx'
Require stack:
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\server\render.js
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\server\next-server.js
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\server\next.js
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\server\lib\start-server.js
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\cli\next-dev.js
- C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\bin\next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.mod._resolveFilename (C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\build\webpack\require-hook.js:183:28)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Felipe\Desktop\programação-estudos\alura-challenge-front-end-1\node_modules\next\dist\server\render.js:11:18)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\server\\render.js',
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\server\\next-server.js',
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\server\\next.js',
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\server\\lib\\start-server.js',
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\cli\\next-dev.js',
'C:\\Users\\Felipe\\Desktop\\programação-estudos\\alura-challenge-front-end-1\\node_modules\\next\\dist\\bin\\next'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
but even if i install the dependecies the same error apears with another dependencie, if i use npm works how it´s supose to works.
edit: my pc had a error in the ssd and some file had been corrupted, but i alredy reinstall npm and yarn but dind´t work.
Related
I am building an e-comm-site clone with react and it was working perfectly fine until I added a 'StateProvider.js', 'reducer.js' and updated my 'index.js' to have my <App /> wrapped like so: <StateProvider initialState={initialState} reducer={reducer}> <App /> </StateProvider>. Now when I run 'npm start' it says:
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'ajv-formats'
Require stack:
/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js
/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/index.js
/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/lib/Server.js
/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/react-scripts/scripts/start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js:25:20)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js',
'/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/index.js',
'/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/lib/Server.js',
'/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/react-scripts/scripts/start.js'
]
}.
The code is identical to that of the course I am following and it works still for them at this stage. Although he has serviceWork.js and I have reportWebVitals.js. Although I can't see how that would be the issue as it was working fine before?
I had the same issue. I removed node_modules and package-lock.json and did npm install and the error has gone
Run the npm install from the root of the project directory command in your terminal.
If the problem persists after running that and restarting your server, the dependency ajv-formats is referenced by your project but not listed as a dependency in your package.json file. Tou can do this by running the command npm install ajv-formats --save
when I run this command in my project:
yarn eject
shows this eror:
[root#VM-0-16-centos cruise-web]# yarn eject
yarn run v1.22.10
$ react-scripts eject
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'react-dev-utils/inquirer'
Require stack:
- /home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js:23:18)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js'
]
}
then I add a dependency in my package.json:
"react-dev-utils":"11.0.1"
then run the command to install and rerun eject:
yarn
yarn eject
but the problem still not fixed, what should I do to make it work?
I just had the same problem. Check out react-scripts version on package.json.
I guessed that this (https://github.com/facebook/create-react-app/pull/10083) would be a reason why yarn eject throw err.
I was able to solve the problem by installing the last version of react-script:
npm install react-scripts#4.0.1
When I run any heroku command or open a page where user is not signed in. This is the only error I'm getting over and over again.
I did remove the Heroku tmp today but I pushed the app fine afterwards, the error suddenly happened.
When i go to the app it opens up if the user is signed in but when opened incognito it has an error, checking the logs it's the same error below
Can anyone help me out on this one?
module.js:491
throw err;
Error: Cannot find module 'universalify'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/ubuntu/.local/share/heroku/client/node_modules/fs-extra/lib/fs/index.js:3:11)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
module.js:491
throw err;
^
Error: Cannot find module 'universalify'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/ubuntu/.local/share/heroku/client/node_modules/fs-extra/lib/fs/index.js:3:11)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
! error getting commands pid 14405 exit 1
Try adding this to package.json and rebuild instanses:
"universalify": "^0.1.1"
or run this command on your server and restart node.js:
npm install universalify --save
I will advice you run these on your terminal in your CWD of the preoject npm uninstall universalify -S --save, which should remove any form of universalify that probably had some missing dependencies during your npm install, after which you can then run npm install universalify --save.
Don't hesitate to comment if you encounter any further challenge.
I was also having this error last time when i'm still doing my project on node . So what i did was . Install every npm that is missing so something like this
npm install universalify --save
If it still persist. Delete the folder of the universalify and reinstall npm again :) . And don't forget to delete it also on your package.json
module.js:471
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v6.11.2/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Uh oh! npm had a problem! { Error: Command failed: "/home/ubuntu/.nvm/versions/node/v6.11.2/bin/npm" --version
module.js:471
throw err;
Trying to do FCC first challenge of node.js but stuck at installing and verifying npm. tried to google the error to debug it but found only questions no answer to it! could anybody help?
It looks like a bug on npm. I recommend to update Node.js and npm.
Run following commands on console:
$ nvm install 6 # This installs Node.js version 6.11.3, current latest version of Node.js 6.x
$ npm install --global npm # Install latest version of npm
I found this issue happen on other learners of Free Code Camp
I honestly dont even know what question I should be asking here, but npm run build fails
> color-organizer#1.0.0 build /home/francis/Desktop/react/chapter-
06/color-organizer
> webpack --progress
module.js:471
throw err;
^
Error: Cannot find module 'set-blocking'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/francis/.nvm/versions/node/v5.0.0/lib/node_modules/webpack/node_modules/yargs/lib/usage.js:5:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
node -v gives me
v6.11.0
so its weird that i see 5 in this error log. I do need to note that i was running on 5 before, and just recently upgraded to 6.11 in the middle of this problem
i'm on ubuntu 16.04
i'm just trying to follow these examples https://github.com/MoonHighway/learning-react/ and start a server for 6, but i can't
and its pissing me off
Running npm install fixed the error for me using the latest versions. Otherwise you may try the command npm install set-blocking or npm install set-blocking --save-dev to only install the module as a developer dependency.