Create-react-app failing with error: node incompatible with css-loader - node.js

I'm simply trying to create a react app with the command npx create-react-app my-app
but get this error:
css-loader#1.0.0: The engine "node" is incompatible with this module. Expected version ">= 6.9.0 <7.0.0 || >= 8.9.0". Got "8.5.0"
I've tried updating node but it seems to not work, checking the version it says 8.5.0 just like in the error.
Even restarted my computer as a last option but that also didn't help..
Is there anything else I could try? Any suggestions are welcome.

I had the same thing and spent few hours trying to figure it out. I think it was the webpack. Finally, I ended updating the node.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Finally realised the problem was my old version of node, I had nvm installed and had to update which node version I'm using with nvm use node.
Update:
I had to use that command every time I started a new terminal session. Also had problems when some other packages were picking up the wrong node version for some reason.
That can be fixed with the command nvm alias default 10.11.0, or which ever version you want to use.

I can confirm that
nvm install node --reinstall-packages-from=node
worked well for me.

I had the same problem, Als tried some stuff and after updating the lates version of node with nvm it worked. I got it from this website: https://bytearcher.com/articles/ways-to-get-the-latest-node.js-version-on-a-mac/
nvm install node --reinstall-packages-from=node

Related

Strapi V4 Error: Can't resolve '#strapi/design-system/themes'

I'm trying to run the new Strapi version 4 application. But it returns this error.
Is there any bug in new strapi v4? or I'm doing wrong anything?
I'm using strapi official guide to start a new project
installation command npx create-strapi-app#latest molla-admin.
NodeJS v16
Windows 11
Error
ModuleNotFoundError: Module not found: Error: Can't resolve '#strapi/design-system/themes' in 'C:\Users\Admin\Desktop\molla-admin\.cache\admin\src'
at C:\Users\Admin\Desktop\molla-<anonymous>:10:1)
You might be thinking #strapi/design-system package is missing right? After that, I also tried to install both #strapi/design-system and #strapi/design-system/themes npm package
Still, it doesn't work. It returns a new error
ModuleNotFoundError: Module not found: Error: Can't resolve '#strapi/icons/CarretDown' in 'C:\Users\Admin\Documents\testing\strapi-v4-app\node_modules\#strapi\helper-plugin\build'
Should I go on for the next missing Module?
For me the issue was solved by installing #strapi/design-system (Node: v14.15.5, npm: 8.1.3)
npm install #strapi/design-system
Node version : 14.18.1
Npm version : 6.14.15
OS : Ubuntu 20.04.3 LTS
Steps I followed:
(I read somewhere that the latest version of node isnt working and
someone mentioned using the 14.18.1 version)
Downgraded NPM to use the 14.18.1 version and not the latest.
npm run build on the strapi project. This gave an error that its
missing #strapi/design-system.
npm install #strapi/design-system, you get another error that its missing #strapi/icons
npm install #strapi/icons . After this step there was an error relating to JSX scritps something to do with reactjs. So, in the next step , I updated Reactjs
npm install --save react#latest
npm run build again and this time SUCCESS!!
The strapi team should mention the issues on their homepage rather that making new users go through hoops to get it working. They need to make it clear that you can run into issues when using certain version of Node etc. As someone mentioned that they are aware of the issue yet no information in the homepage where new users visit to try it out. It should've been placed as a BANNER at the top in BOLD TEXT.
It's a known bug and they are working on a fix.
You have to use yarn in the mean time.
I can confirm that this bug is related to using Node v16. To get around the bug, I first ran:
nvm use 14.18.1
Afterwards, running the following resulted in successful compilation:
npm run build -- --clean
No need to attempt installation of #strapi/design-system.
I got this error because I was using Node v16. There was a message somewhere in my troubleshooting that you have to use A Node version >=10.X.X.X and <=14.X.X.X
I used NVM(Node Version Manager) to switch to 14.17.6 and it works
following solution worked for me:
yarn add #strapi/design-system
yarn add #strapi/icons
work on windows and ubuntu
node v14.15.0
yarn 1.22.17
npm 6.14.8
npm install #strapi/design-system
solution worked for me.
node 16.13.1
npm 8.1.4
macOS 12.0.1 on M1Max

Unknown error: SyntaxError: Unexpected token 'export' on ng command

I'm trying to learn Angular
I've followed the steps here: https://angular.io/guide/setup-local to get it setup on Ubuntu 18.04.5 LTS
When I try to create a new project with ng new I get an error:
$ node -v
v14.12.0
$ npm -v
6.14.8
$ ng new test
Unknown error: SyntaxError: Unexpected token 'export'
$ ng -v
Unknown error: SyntaxError: Unexpected token 'export'
I installed it via sudo npm install -g #angular/cli which gave no errors.
I've purged node sudo apt-get purge nodejs and reinstalled and removed ng sudo npm remove -g #angular/cli then reinstalled again sudo npm install -g #angular/cli, still get this error. Any ideas?
There was an older version of nodejs on the system originally; I upgraded to 14.x. Export is part of ES6, perhaps it's related? I can't seem to figure it out.
I had the same issue and I could fix it by downgrading node to v12.8.1
You could use nvm as follows:
install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
refresh .profile
source ~/.profile
install node v12.8.1
nvm install v12.8.1
check that you are using the 12.8.1 version
nvm list
check ng again
ng -- version
You are using an incompatible NodeJs version. Install a lower version.
More information here (webarchive version).
Check for node versions.
use nvm
brew install nvm
I had the same problem. if you have any other version of Node that might fix it
On the Angular Github
node requirement is below
"engines": {
"node": ">=10.13.0 <13.0.0",
"yarn": ">=1.22.4"
}
after installing the older version
nvm install 12.4.0
then
nvm use 12.4.0
this did the fix for me
For me no solution worked so I uninstalled everything, both the angular and node cli, thinking that it was a version error, but when I typed ng in the console, the error kept appearing so I found where ng was, with whereis ng, delete the file and install all over again.
Run the following command on cmd. This recommends that you always update to the latest patch version, as it contains fixes we released since the initial major release. For example, use the following command to take the latest 10.x.x version and use that to update.
ng update #angular/cli#^<major_version> #angular/core#^<major_version>
First of all Don't run any command which is collected from here and there. Simply follow these steps.
1 uninstall current NodeJS version
2 download lowest version from here.
3 install the lower NodeJS version.
4 restart cmd Promat/terminal and try.
This worked for me.
Have encountered this error many a times in past.
What worked for was removing the package.lock and node_modules & rerun the npm install.
cached code might be causing the trouble.
Install a newer node version and also reinstall angular. For me it did not work with only installing a newer node.

Node error _xdl(...).ProjectUtils.readConfigJsonAsync is not a function

After installing expo-CLI Version 3.5.0 to my computer so that I'm able to use it and then running npm start Node throws this error:" _xdl(...).ProjectUtils.readConfigJsonAsync is not a function. " I cannot find the solution to this online, it appears to be a new issue. Is anyone else running into this or have a solution for successfully running the program?
I also got the same issue. You don't need to downgrade node, just need to change some hashes on your project. (worked on node version 13.2.0 and expo-cli version 3.9.0 for me, although I have noticed that it also worked on LTS node 12.13.1 )
You can change the file located at:
\node_modules\metro-config\src\defaults\blacklist.js
From :
var sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
To:
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
I need a solution as well. i have been using 3.5.0 version but today i tried to update it by mistake and i couldnt find a way yet to make it run normally. im starting to think the problem is server side or something updated is not compatible with old 3.5.0 version.
_xdl(...).ProjectUtils.readConfigJsonAsync is not a function
Screenshot of the error im getting
Edit: i just found the solution. new version of the xdl causes the error.
Fix:
Open up a command prompt(if you are on a windows machine), no matter which directory you are at, type commands below
npm uni -g --no-save #expo/xdl
npm i -g --no-save #expo/xdl#56.8.0
if you don't specify what version you want to install, npm or yarn will immediately select 56.8.1 version and installs automaticly and causes the error.
you need to downgrade to 56.8.0 version by typing the commands that i gave above.

The engine "node" is incompatible with this module

I am getting below yarn error when deploying to AWS
error fs-extra#7.0.1: The engine "node" is incompatible with this module. Expected version ">=6 <7 || >=8". Got "7.0.0"
Any idea how will this be resolved?
Will this work out if I specify engine in package.json
{
"engines" : {
"node" : ">=8.0.0"
}
}
You can try to ignore the engines :
$ yarn install --ignore-engines
OR
$ yarn global add <your app> --ignore-engines
You can see all what you can ignore by running:
$ yarn help | grep -- --ignore
--ignore-scripts don't run lifecycle scripts
--ignore-platform ignore platform checks
--ignore-engines ignore engines check
--ignore-optional ignore optional dependencies
You need to upgrade your version of node.
I ran into this same issue.
If you used Homebrew run:
brew update # This updates Homebrew to latest version
brew upgrade node
If you use nvm run:
nvm current node -v # Checks your current version
nvm install <version> # Example: nvm install 12.14.1
For the above step go to https://nodejs.org/en/download/
Grab a version which satisfies the conditionals in your error, the latest version should work.
More Detailed Walkthrough: https://flaviocopes.com/how-to-update-node/
A fix that is a hack can be
yarn config set ignore-engines true
However if you want a permanent solution is to :
delete node_modules/, package-lock.json & yarn.lock
run yarn install or npm i again.
Add --ignore-engines to the suffix while installing the package like this:
yarn add <package_name> --ignore-engines
My problem was solved with yarn --ignore-engines, but I'm not sure why and how.
I had a similar issue on Ubuntu even after installing Nodejs many times with the latest version, it was showing always the same old Nodejs version; I discovered it was installing the similar old Debian package each time, even after executing the apt-get update command
Finally, I got it to work by purging the old nodeJs then adding different repository source, and installing nodeJs normally with the new distribution as follows:
sudo apt-get purge --auto-remove nodejs
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Please find the list of all NodeJs distribution below
https://github.com/nodesource/distributions/blob/master/README.md
You may find other ways of doing the update, but this one worked for me.
I do NOT recommend using this:
% yarn install --ignore-engines
It avoids the issue instead of solving it.
A possible solution would be to update your node to version > 8.0.
% brew upgrade node
Or you could try installing multiple versions of node by using nodenv, in case you need them for other projects.
% brew install nodenv
% nodenv init
# Load nodenv automatically by appending
# the following to ~/.zshrc:
eval "$(nodenv init -)"
% nodenv install 6.0.0 //or some other version
Lots of answers say to set flags to ignore the version error.
A better option is to use this as a reminder to update your node version to something recent and supported by the package you want to install.
nvm install 16.16.0 # download & install locally on your system
nvm use 16.16.0 # update current project's .nvmrc file
Note that the 2nd command will update your local .nvmrc which specifies a per-project node version.
The node ecosystem turns over quickly, even "Long Term Support" (LTS) releases stop getting support after about 3 years. Use this page to see the latest LTS release version, and also make sure it matches the node version expected by the package you're installing, from the error message.
You can try:
Open you package.json
find
"engines": { "node": "14.x" }
change 14.x -> >=14.x
I recommend doing what the error message says and checking your Node.js version (node -v). The easiest way to upgrade Node.js is with the n version manager:
$ npm install -g n
Then install the latest (n latest) or LTS (n lts) version of Node.
What worked for me was to update Node to the latest version. Following any tutorial depending on your OS.
Upgrading Node.js to latest version
sudo npm cache clean -f
sudo npm install -g n
sudo n 10.22.1
node -v => Should be on 10.22.1
type what version of node you require as I have just put 10.22.1 as an example
Update your Node.js to the latest version.
https://nodejs.org/en/download/
you need to run the below command and your problem will be solved
yarn install --ignore-engines
or
npm install --ignore-engines
This is a lot more problematic than it seems on the surface.
If you include a module that requires node 6, but you have other modules that use node 11, you will get this error!
It's problematic when it's 3rd party modules you've used nom/yarn/etc. to install, as you don't have access to those package repos without doing git fork.
In my case, I am using yarn workspaces and some of the modules in the package.json files in the workspaces might require foo 1.0 while others require foo 2.0 and the 1.0 version might require node 6 and the 2.0 version might require node 14.
The only solution I found is to use --ignore-engines, though it clearly is what other(s) have posted - that this is not fixing the problem, just ignoring it in spite of any issues that might be caused (node 6 code might not run on node 14!).
Sometimes you cannot upgrade the Node engine (legacy projects, client requirements etc). The solution I found in this case was to downgrade the problematic versions by using "selective dependency resolution", as documented on Yarn:
https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/
{
"name": "project",
"version": "1.0.0",
"dependencies": {
"left-pad": "1.0.0",
"c": "file:../c-1",
"d2": "file:../d2-1"
},
"resolutions": {
"d2/left-pad": "1.1.1",
"c/**/left-pad": "^1.1.2"
}
}
Notice the "resolutions" part. You can force those packages to downgraded versions (compatible with your older Node engine).
I found this problem now, with an old code, however, I solved it with:
yarn upgrade
Just found that not only I need to upgrade the node, but also need to install it.
This upgrades node to latest version:
brew upgrade node
This install the specific version of node:
nvm install 17.0.0
Upgrade your version of node , this issue will be resolved

error eslint#5.6.0: The engine "node" is incompatible with this module. when trying to create-react-app

I am trying to create a React App and I am getting the following error in my console.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning react-scripts > eslint > file-entry-cache > flat-cache > circular- json#0.3.3: CircularJSON is in maintenance only, flatted is its successor.
[2/4] 🚚 Fetching packages...
error eslint#5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.5.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Volumes/server2/Desktop/JavaScript/birdcage has failed.
Deleting generated file... package.json
Deleting birdcage / from /Volumes/server2/Desktop/JavaScript
Done.
I have tried brew upgrade node but that didn't seem to work. Any ideas on how this can be fixed would be greatly appreciated.
One of the temporally fix is to run yarn install --ignore-engines
I was facing the same issue, try to add "--use-npm" at the end of create react app commend.
create-react-app appname --use-npm
I had the same problem, simply doing this solved the problem:
npm install node#latest
Try to uninstall yarn and install it via npm.
npm i create-react-app -g
create-react-app yourappname
Make sure that node is installed!
I had the same problem, try it:
yarn config set ignore-engines true
I re-installed node and updated xcode developer tools. Also, re-installed React on that computer which is running Mojave.
Assuming nvm is installed, use it to see which version of node you're using, then use it to change to a later version.
you can change the version with nvm use <version> and then try again
In my Ubuntu 18.04 had a native version from the OS installed that not listed by NVM.
I removed it and then I ran:
Firstly run, nvm install 14.5.0
then run, nvm use 14.5.0
And the installation completed properly.
i had same issue when i was adding router plugin to vue-cli with npx and yarn as well..
In pyhton virtual environment i have updated node version from 8.x.x to 16.x.x and used command nvm use 16.x.x but still problem persists .. i was actually executing command as root .. so nvm is using node version as 8.x.x only ..
after long time i realised executing command with sudo was the issue and then executed as a normal user...
this solution worked for me !!!
As the warning said, I updated node via nvm to the version required. For me having the latest node lts version was enough.
nvm install "lts/*" --reinstall-packages-from="$(nvm current)"
But even after upgrading node, yarn still gave the error.
The problem was npm was still executed from the old .bin path of previous node version. nvm also installs latest version of npm in respective local .bin folder for the node version installed.
I used the following commands then,
nvm install-latest-npm: Attempt to upgrade to the latest working npm on the current node version
nvm install --latest-npm: After installing, attempt to upgrade to the latest working npm on the given node version
After this, it worked properly.
Reference:
How can I change the version of npm using nvm?

Resources