Build fail with an error about fs-extra module, using circle cI and create react app - node.js

I have been trying to use circle ci with create react app, but I confronted this error.
#!/bin/bash -eo pipefail
CI=true npm run build
> react-scripts build
/home/circleci/project/node_modules/react-scripts/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! robofriends#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robofriends#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2021-09-24T23_47_26_734Z-debug.log
Exited with code exit status 1
CircleCI received exit code 1
These are my simple setup.
# .circleci/config.yml
version: 2.1
jobs:
build:
docker:
- image: circleci/node:9.8
steps:
- checkout
- run: echo "npm installing"
- run: npm install
- run: CI=true npm run build
// package.json
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^7.2.4",
"react-scripts": "^4.0.3"
Does anyone have any clue why this error comes up?
Would this be about node version or something?...

I have changed the node image to the latest and it worked!!
- image: circleci/node:latest

Related

error when try to run npm build on react project

i'm trying to deploy my app via VPS (Ubuntu and Nginx) but this error keeps showing up, (on vs code it works fine) any idea how could i procede? thanks!
> mystery#0.1.0 build /home/react-projects/portfolio
> react-scripts build
/home/react-projects/portfolio/node_modules/eslint-webpack-plugin/node_modules/jest-worker/build/index.js:110
_ending;
^
SyntaxError: Unexpected token ;
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/react-projects/portfolio/node_modules/eslint-webpack-plugin/dist/getESLint.js:9:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mystery#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mystery#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-08-23T18_10_04_282Z-debug.log
one way you can :
go to your package.json
replace "react-scripts": "..." to "react-scripts": "1.1.4",
then run npm install, after that npm build
if it didn't work try :
create a file .env at the root of the folder react folder
type SKIP_PREFLIGHT_CHECK=true inside of .env file
this command will help you in resolving this npm error.
then try to run npm build and check it should work .
notice : this command will permanently disable this preflight check
Updating node to higher version worked for me, i was using v10.22.1: nvm use --lts
i solved it installing the correct versions through NVM on my web server
https://www.freecodecamp.org/news/how-to-install-node-js-on-ubuntu-and-update-npm-to-the-latest-version/

saleor salor-dashboard npm start gives errors

I am trying to install the saleor-dashboard latest version(3.7.0), but getting strange errors.
I have done npm start, npm audit fix --force npm install but got the same error and read from a Github page https://github.com/rails/rails/issues/43062#issuecomment-904965034 and a stackoverflow page that the current webpack dev server version is not compatible so I should downgrade it to version 3. I did that as well, but I am still facing the same issue.
The error is:
/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:46
return func(...args);
^
TypeError: Class constructor ServeCommand cannot be invoked without 'new'
at runWhenInstalled (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)
at promptForInstallation (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:140:10)
at /root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/cli.js:32:43
at Object.<anonymous> (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! saleor-dashboard#3.7.0 start: `npm run build-types && webpack-dev-server -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the saleor-dashboard#3.7.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-09-03T06_21_34_373Z-debug.log
My package.json includes:
"devDependencies": {
"ts-jest": "^27.0.7",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^4.3.5",
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.4.1",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "3.11.2",
}
Would appreciate a lot if somebody can help me with this.

Next.js tutorial, error running Next.js dev server (npm run dev)

I'm doing the starter Next.js tutorial and encountering an error when I try to run the Next dev server and run my app.
Here is what my package.json file contains:
{
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "^12.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
When running npm run dev, I get the following error:
> # dev /Users/renaudj/Documents/Projects/next-app
> next dev
/Users/renaudj/Documents/Projects/next-app/node_modules/next/dist/trace/report/index.js:14
reporters = [];
^
SyntaxError: Unexpected token =
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/renaudj/.npm/_logs/2022-07-04T05_09_15_196Z-debug.log
Anyone know what I'm missing here? Thank you!
I update my node version V11.15.1 to V12.22.1 then it's solved
I update my node version V10->V16. it' work
Yes, updating your version of node will solve this issue.
Before doing this, delete the node_modules folder in your project.
Then to update node to the latest stable version, run the following command on your terminal:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
You may need to restart your terminal to see the version update which you check using:
node -v
Then reinstall your project using
npm install
Basically I have multiple versins of node.
It is possible through nvm
I switched to node 14 using the command :
node use 14.15.0

problem with laravel and vue.js | Error: Cannot find module

I recently got this error whenever I install vue in laravel using the following commands:
composer require laravel/UI
PHP artisan up vue
php artisan ui vue --auth
npm install && npm run dev
I get this new error and its the first time that happened to me:
Error: Cannot find module 'webpack/lib/rules/DescriptionDataMatcherRulePlugin'
Require stack:
- C:\wamp64\www\projects\quizapp\node_modules\vue-loader\lib\plugin-webpack5.js
- C:\wamp64\www\projects\quizapp\node_modules\vue-loader\lib\plugin.js
- C:\wamp64\www\projects\quizapp\node_modules\vue-loader\lib\index.js
- C:\wamp64\www\projects\quizapp\node_modules\laravel-mix\src\components\Vue.js
- C:\wamp64\www\projects\quizapp\node_modules\laravel-mix\src\components\ComponentRegistrar.js
- C:\wamp64\www\projects\quizapp\node_modules\laravel-mix\src\Mix.js
- C:\wamp64\www\projects\quizapp\node_modules\laravel-mix\setup\webpack.config.js
- C:\wamp64\www\projects\quizapp\node_modules\webpack-cli\lib\webpack-cli.js
- C:\wamp64\www\projects\quizapp\node_modules\webpack-cli\lib\bootstrap.js
- C:\wamp64\www\projects\quizapp\node_modules\webpack-cli\bin\cli.js
- C:\wamp64\www\projects\quizapp\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (C:\wamp64\www\projects\quizapp\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object.<anonymous> (C:\wamp64\www\projects\quizapp\node_modules\vue-loader\lib\plugin-webpack5.js:6:42)
at Module._compile (C:\wamp64\www\projects\quizapp\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\vue-loader\\lib\\plugin-webpack5.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\vue-loader\\lib\\plugin.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\vue-loader\\lib\\index.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\laravel-mix\\src\\components\\Vue.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\laravel-mix\\src\\components\\ComponentRegistrar.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\laravel-mix\\src\\Mix.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\laravel-mix\\setup\\webpack.config.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\webpack-cli\\lib\\webpack-cli.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\webpack-cli\\lib\\bootstrap.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\webpack-cli\\bin\\cli.js',
'C:\\wamp64\\www\\projects\\quizapp\\node_modules\\webpack\\bin\\webpack.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # watch: `mix watch`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\zzzab\AppData\Roaming\npm-cache\_logs\2021-08-05T07_08_51_267Z-debug.log
and I tried to make a new laravel project and didn't work.
Finally, i have the solution,
1- Delete the node_modules folder using the file explorer and delete package-lock.json as well.
2- Run npm install command.
3- Run npm run dev or npm run watch for auto mix when ever change made.

Node.js / npm: Can't find module when running in dev mode

When running npm run dev, I got the following error message:
Error: Cannot find module 'webpack/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
at Function.Module._load (internal/modules/cjs/loader.js:497:25)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Isabelle\coursetro-eth\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! coursetro-eth#1.0.0 dev: `webpack-dev-server --config build/webpack.dev.conf.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the coursetro-eth#1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
My enviroment is the following:
OS: Windows 10
NPM: Version 5.6.0
WebPack: Version 4.6
My package.json file:
{
"name":"coursetro-eth",
"version":"1.0.0",
"main":"index.js",
"scripts":{
"dev":"webpack-dev-server --config build/webpack.dev.conf.js",
"publish":"ngc -p tsconfig-aot.json",
"test":"echo \"Error: no test specified\" && exit 1"
},
"author":"",
"license":"ISC",
"description":"",
"dependencies":{
"web3":"github:ethereum/web3.js"
},
"devDependencies":{
"lite-server":"^2.3.0",
"webpack":"^4.6.0",
"webpack-cli":"^2.0.15",
"webpack-dev-server":"^2.11.2",
"webpack-validator":"^2.3.0"
}
}
What is this error about?

Resources