React-Native dependencies integration issue - react-native

I'm beginner in react-native Sorry in advance if found issues in question asking.
I cloned a repository from remote server where now i've empty node_modules directory. I've "package.json" file with all dependencies list while when I run "npm install" I didn't get dependencies in node_modules directory and got number of warnings on terminal related to different files as you can see here.

delete node_modules folder.
Then try to do npm install first. it ll added node modules folder.
after that try to install dependancies..you can find necessary dependancies from json file.
ex:- npm install --save depencencyname#versionnumber
for some modules you have to link them before it use..
using react-native link dependancyname

Related

How to create build for forked React Native npm package

I forked a React Native npm library react-native-calendars to make some changes to it. I now want to implement these changes in my project. I have installed it in my project using:
npm i git+<my_forked_git_repo_url>
This successfully added the package to my node_modules, however I still get an error in my code when I try and import react-native-calendars saying Cannot find module. After doing some research I found (here) that I must create a build using npm run build and add it to the forked repository.
However, when I run npm run build it creates a build directory in my ios/ directory (since I am targeting iOS). Is this expected, or should I have a new build/ directory in the root directory? The contents of this build/ directory include a ...-buildRequest.json, ...-desc.xcbuild, ...-manifest.xcbuild, ...-targetFile.txt, and a BuildDescriptionCacheIndex-....
You could:
install the original package
paste your changes into the package's code in node_modules
install patch-package if you don't already have it (follow the instructions here)
run npx patch-package react-native-calendars
This will create a diff between the original package and your changes. Then your changes will be applied every time you run yarn or npm.

How does react-scripts install extra dependencies?

To reproduce what I'm talking about
Create an empty directory
cd into the directory and run npm init
run npm install react-scripts
look at the node_modules directory. react-scripts exists inside node_modules, but it also installs many other dependencies required to run a project with create-react-app.
Looking at react-scripts directory in node_modules, I don't see any pre or post install scripts. I do see a react-scripts/bin/react-scripts.js script that im assuming is the entrypoint for the code installing these extra dependencies.
How is that file being run?

Install Nestjs peer dependencies for development

I download source code of (Nestjs)[https://github.com/nestjs/nest] framework and try to install its dependencies by running npm ci and after that lerna bootstrap. It works fine some how. But when I run tests it fails on nest-application.spec.ts file arguing it has #nestjs/microservices dependencies which is not resolved. As I see in core package node_modules folder there is only a symlink to common package. Although in core's package.json file #nestjs/microservices is marked as peer dependencies but lerna does not put it's symlink in node_modules folder. I also though that was an issue and opened a pull request https://github.com/nestjs/nest/pull/10165 which added #nestjs/microservices as devDependencies in package.json file which got rejected by kamil. If thats not a issue how can I install peer dependencies by lerna or any other method? How do themselves develop the project? Of course I can manually symlink the folder but I'm sure kamil is not doing it this way :)

npm 5 install folder without using symlink

Before publishing my node library, I could use the advice the npm documentation wrote about:
To test a local install, go into some other folder, and then do:
cd ../some-other-folder
npm install ../my-package
Prior to version 5 of npm, I had no problem as it produce what I expected, ie a folder with the output of what I will publish.
However, using npm 5, it now creates a symlink to my local project as described in the npm documentation:
npm install :
Install the package in the directory as a symlink in the current
project. Its dependencies will be installed before it's linked. If
sits inside the root of your project, its dependencies may be
hoisted to the toplevel node_modules as they would for other types of
dependencies.
How can I use the "old" way to install local project? Or is there a new way to check if my library is correct?
Thank you.
Use npm pack + npm install (as suggested by install-local package)
npm pack <path-to-local-package>
npm install <package-version.tgz>
This will effectively copy your local package to node_modules.
Note that this will package only production relevant files (those listed in the files section of your package.json). So, you can install it in a test app under the package own directory. Something like this:
my-package
package.json
test
test-app
package.json
node_modules
my-package
Assuming that test dir is not included in the files in my-package/package.json.
This works the same way with npm 5 and older versions.
I wrote npm-install-offline which allows you to install npm packages from a local repository or folder. By default it copies the folder on install but you can also choose to symlink.
https://www.npmjs.com/package/npm-install-offline
npx npm-install-offline ../some-package
Or
npx npm-install-offline my-npm-package --repo ./my-offline-npm
It also will install the package dependencies which npm does not do with local packages.

Command invalid: run always ask to create a project

I have a project about 4 months and suddenly the aurelia's CLI commands are not working.
When I try to execute au run --watch I receive a message with options to create a new project under the path.
I have already tried to uninstall and reinstall the aurelia CLI, It's not work.
The last thing I have done was to execute a git clean -xdf
I think that could be something on my project. Someone could help me?
ANSWER
After some attempts I fixed the problem:
1) I reinstall Git and Node;
2) I have deleted all the files under the \AppData\Roaming\npm-cache path;
3) I have checked if the Git and Node were in the PATH of environment variables;
4) I run the npm install command;
Is aurelia-cli included in the devDependencies of the project and also installed globally?
First, install globally:
npm i -g aurelia-cli
Then, in the project directory, install & save to devDependencies:
npm i --save-dev aurelia-cli
You should then be able to run au in the project directory and see that the build and run commands are now available.
Note that you'll also need to install the necessary gulp dependencies required by the tasks in your project devDependencies.
EDIT: See aurelia/cli/issues/485 which confirms that installing aurelia-cli as a local dependency fixes this issue.