0

Created a new react project with the package.json below:

   {
      "name": "test-react-app",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      "eslintConfig": {
        "extends": [
          "react-app",
          "react-app/jest"
        ]
      },
      "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
        "development": [
          "last 1 chrome version",
          "last 1 firefox version",
          "last 1 safari version"
        ]
      },
      "dependencies": {
        "immutability-helper": "^3.1.1",
        "node-sass": "^7.0.1",
        "react": "^18.1.0",
        "react-dnd": "^16.0.1",
        "react-dnd-html5-backend": "^16.0.1",
        "react-dom": "^18.1.0",
        "react-router-dom": "^6.3.0",
        "react-scripts": "^5.0.1",
        "sass-loader": "^13.0.0",
        "scss": "^0.2.4",
        "web-vitals": "^2.1.4",
        "webpack": "^5.72.1"
      }
    }

whenever I run npm start I am given the following error:

ERROR in ./src/index.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/index.css)

Module Error (from ./node_modules/postcss-loader/dist/cjs.js):
Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'node:vm'
Require stack:
- C:\Users\xxx\Desktop\lcnc - prototype\lcnc\node_modules\@csstools\postcss-trigonometric-functions\dist\index.cjs
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\postcss-preset-env\dist\index.cjs
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\postcss-loader\dist\utils.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\postcss-loader\dist\index.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\postcss-loader\dist\cjs.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\webpack\lib\NormalModule.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\webpack-manifest-plugin\dist\index.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\react-scripts\config\webpack.config.js
- C:\Users\xxx\Desktop\lcnc - prototype\test\node_modules\react-scripts\scripts\start.js

does anyone have any ideas on how to possibly fix, I have been trying to use the documentation to start this project but keep running into this issue

Unprof
  • 27
  • 5
  • 1
    Does this answer your question? [CRA project node v14.17.0 - Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'node:vm'](https://stackoverflow.com/questions/72452453/cra-project-node-v14-17-0-loading-postcss-postcss-preset-env-plugin-failed) – SMAKSS May 31 '22 at 19:59
  • This was fixed in postcss-preset-env. For support you can always open an issue : https://github.com/csstools/postcss-plugins/issues – R Menke Jun 04 '22 at 16:22

1 Answers1

0

When you open up your terminal, make sure you are in the correct directory. Maybe run start from "test-react-app" if this is the name of your app. It seems you are trying to start from "lcnc". let's say in terminal

" cd test-react-app " " npm install " " npm start "

this could possibly be the reason, you must be in your app directory, then you will install the sass dependencies from there. Start it up.

BLCKSTRT
  • 41
  • 6