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
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'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.
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 get the following error running the polymer cli.
$ polymer
module.js:327
throw err;
^
Error: Cannot find module '..'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /usr/local/lib/node_modules/polymer-cli/bin/polymer.js:19:36
at /usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:46:14
at process (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:173:43)
at ondir (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:188:17)
at load (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:69:43)
at onex (/usr/local/lib/node_modules/polymer-cli/node_modules/resolve/lib/async.js:92:31)
I've tried node 4.x and 6.x
I've also tried to install different versions of polymer-cli, 0.8 and 0.10
I'm running node on Ubuntu 16.04.
Does anyone know what issue I'm running into or how I can resolve this?
Ok wow after quite a lot of digging and searching, I found the answer. Turns out I had previously tried to install polymer-cli using the default ubuntu package. This installed it in a separate location, also on the global path.
When I remove NodeJS and NPM to install the latest version via the PPA, the original polymer-cli was still left on my path. So when I then installed the latest polymer-cli, this was correctly installed, but was never the one being executed since the old one was found on the path first.
I manually deleted all node_modules folders and after doing that I was able to install and run the correct version of polymer-cli, and it now works perfectly fine.