I'm trying to run react app I got this error:
☁ app [master] yarn start
yarn run v1.22.17
$ react-scripts start
node:internal/modules/cjs/loader:488
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /Users/li/Documents/reacts/app/node_modules/postcss-safe-parser/node_modules/postcss/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)
at packageExportsResolve (node:internal/modules/esm/resolve:669:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/li/Documents/reacts/app/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v17.0.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
How do I download the app ?
npx create-react-app my-app
cd my-app
npm start
my stuff version
node -v v17.0.1
yarn -v 1.22.17
npm -v 8.1.4
I've tried every single thing in this but nothing worked for me
I was also getting this error, then I ran npm update and that seemed to clear up this error. But now I'm getting a new error about "no such file or directory, stat '/home//.steampath'"
Maybe that's just a separate issue with mine though, hopefully npm update works for you!
Edit: I was able to fix my "no such directory" error, it was caused by an issue with me trying to transfer a file from a different drive. I was able to resolve it. So unless you also have that same problem, npm update should fix it for you.
I had this issue, as well. I was able to get CRA to work by installing/using Node v16.13.1 via NVM. This is an issue with CRA depending on an old version of postcss-safe-parser referenced here.
First install NVM and then ...
nvm install 16
Make sure node 16 is being used by NVM and yarn start should work.
Related
I'm using MacOS monterey with M1 chip as my operating system. installed NestJS cli using this command: sudo npm install -g #nestjs/cli
when creating new nest project using nest new message everything works fine, but when I try to create new module using this command nest generate module messages I face error.
why does this happen? I tried installing schematics using npm i -g #nestjs/schematics, I don't know if I should've installed it but this didn't help anyway.
The error I face is:
/Users/homayoun/training/messages/node_modules/#angular-devkit/schematics-cli/bin/schematics.js:338
throw new Error(`Unknown argument ${key}. Did you mean ${(0, yargs_parser_1.decamelize)(key)}?`);
^
Error: Unknown argument skipImport. Did you mean skip-import?
at parseArgs (/Users/homayoun/training/messages/node_modules/#angular-devkit/schematics-cli/bin/schematics.js:338:19)
at main (/Users/homayoun/training/messages/node_modules/#angular-devkit/schematics-cli/bin/schematics.js:122:49)
at Object.<anonymous> (/Users/homayoun/training/messages/node_modules/#angular-devkit/schematics-cli/bin/schematics.js:367:5)
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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Failed to execute command: node #nestjs/schematics:module --name=messages --no-dry-run --no-skipImport --language="ts" --sourceRoot="src" --spec.
worth noting that I don't face any issues when I do the same thing on ubuntu 20 or 22
Quick solution:
add this to your nest-cli.json
"root": "src"
change into the src of your project folder
cd src
run
nest generate module messages
if the above does not work also try changing the version of packages in package.json to
"#nestjs/cli": "8.2.6",
"#nestjs/schematics": "8.0.11",
removing the node modules in the current project
reinstalling the nest cli with
npm uninstall -g #nestjs/cli
npm i -g #nestjs/cli#8.2.6
this is a bug on the latest version of #nestjs/cli (v8.2.7). Downgrade it to 8.2.6 and it will work (I tested it). It was reported here: https://github.com/nestjs/nest-cli/issues/1693
Also, I don't recommend using the global version of the CLI. Instead, use npx nest or yarn nest.
I am trying to create a strapi app using:
npx create-strapi-app my_project --quickstart
At the end of the installation I got this error:
(node:23048) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\koa\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-08-14T08:03:48.649Z] debug ⛔️ Server wasn't able to start properly.
[2021-08-14T08:03:48.650Z] error Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\constructor.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\index.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi-plugin-upload\services\image-manipulation.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\load\load-files.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\core\load-apis.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\core\load-modules.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\Strapi.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\index.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\commands\develop.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\bin\strapi.js
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\constructor.js:32:9)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153: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)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\index.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
The fixes I tried:
I deleted the sharp directory from the node_modules folder
I ran this command (as suggested by the terminal)
npm install --ignore-scripts=false --verbose sharp
Then, when I ran npm run develop, I got the following error:
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-08-14T08:23:02.906Z] error The client `sqlite3` is not installed.
[2021-08-14T08:23:02.907Z] error You can install it with `$ npm install sqlite3 --save`.
I am not sure why it is giving me this error as I have sqlite3 installed automatically. Nonetheless, I have deleted it and reinstalled it, but still having the same error over and over again!
If anyone could help with this one, I would really appreciate it! Thank you!
Turns out the problem was with my npm version. Strapi does not support the latest npm version (v7). To get it to work properly, just downgrade to (v6)(npm i -g npm#6.14.14) and it should work fine!
-- Another possible fix:
Run the Strapi app inside a Docker container to avoid all issues! Check the 'How to run a Strapi app with Docker' instructions on the Strapi website for full details.
I have a ReactJS project and I was trying to use some of the PrimeReact components. At some point, I faced an error (can't remember exactly which one) and I tried to run an older version of NPM in a copy of my main directory.
Now, I get this error every time, even when I run npm command.
I've already tried to delete my node_modules folder, delete my project and clone it back from GitHub and also to reinstall NodeJS several times. I don't know what to do!
I have Windows 10 and I'm using NodeJS v12.16.0.
Thanks to anyone that offers some help
Update: I have never installed gulp. I suppose that maybe some dependency is using it but, because I can't run any npm command, I can't remove them D:
The error:
C:\Users\Carlos>npm
evalmachine.<anonymous>:35
} = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:35:5
at Object.<anonymous> (C:\Users\Carlos\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\node_modules\graceful-fs\fs.js:12:1)
at Module._compile (internal/modules/cjs/loader.js:1157:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
at Module.load (internal/modules/cjs/loader.js:1001:32)
at Function.Module._load (internal/modules/cjs/loader.js:900:14)
at Module.require (internal/modules/cjs/loader.js:1043:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Carlos\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1157:30)
It might be an error related with gulp and node v12 conflict. If you have the gulp installed globally in your environment and you can uninstall without problems, you can try it. To help with commands, check if you have the gulp installed, typing this in your command line interface:
gulp -v
Uninstall your version:
npm uninstall -g gulp
I have a native Node addon I wrote that I'm trying to add to an Electron app. I use npm install /path/to/addon to install the addon. Then electron-rebuild and electron-build, which don't complain.
But when I run npm start, in the dev console I get the following error:
Uncaught Error: No native build was found for platform=win32 arch=x64 runtime=electron abi=75 uv=1 libc=glibc
at Function.load.path (C:\path\to\node_modules\node-gyp-build\index.js:55:9)
at load (C:\path\to\node_modules\node-gyp-build\index.js:20:30)
at Object.<anonymous> (C:\path\to\index.js:2:42)
at Object.<anonymous> (C:\path\to\index.js:27:3)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
I can't find much online regarding this error. I've tried recompiling everything, tried rebuilding the addon with Electron as target and nothing helps. Why does this error happen, and how can I remedy it?
The error was with a silly one.
In index.js, I was doing
let addon= require("node-gyp-build")("./");
Essentially, "./" will not link correctly when installed with npm since ./ is the root directory of the current project not the installed. Using __dirname instead will properly link the addon
let addon= require("node-gyp-build")(__dirname);
Note: I also switched to using prebuildify which means I no longer have to run npm electron-builder
I am trying to run a react-native project on android emulator, but before I can get it to run properly, I need to run this command:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
I got this command from this question, as I was having the problem described there. This worked yesterday, but I created a new project this morning, and now running the command hits an error with the following stack trace:
Error: Cannot find module 'jest-serializer'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at _load_jestSerializer (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:164:52)
at HasteMap._persist (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:781:25)
at _buildPromise._buildFileMap.then.then.hasteMap (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:425:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
I ran npm install -g jest-serializer and got back
+ jest-serializer#23.0.1
updated 1 package in 0.498s
So the module must exist on my machine. Why is react-native bundle having trouble finding it?
Edit
Installing the jest-serializer locally fixed the problem, but why can't the react-native bundle script find the package if it's installed globally
I just ran into this issue also.
Looking into it I found out jest-serializer was updated yesterday to "24.0.0-alpha.7".
I had to install the previous version to get it working.
The command I ran in the project was
npm install jest-serializer#24.0.0-alpha.6