rollup plugins not recognizing installed rollup - rollupjs

I installed rollup globally:
npm install -g rollup
Then, I tried to install a plugin, locally:
C:\wwwroot\speech-to-text [master +9 ~0 -0 !]> npm install rollup-plugin-json
npm WARN rollup-plugin-babel#4.0.3 requires a peer of rollup#>=0.60.0 <1 but none is installed. You must install peer dependencies yourself.
npm WARN rollup-plugin-commonjs#9.1.8 requires a peer of rollup#>=0.56.0 but none is installed. You must install peer dependencies yourself.
npm WARN speech-to-text#1.0.0 No repository field.
+ rollup-plugin-json#3.1.0
updated 1 package in 1.895s
It gives warnings that rollup isn't installed. Does anyone know why? Here is me checking the version, in case you doubt that rollup was actually installed:
C:\wwwroot\speech-to-text [master +9 ~0 -0 !]> rollup -v
rollup v0.66.2

I believe the problem is that you have installed rollup in the global context.
You may try to install rollup this way
npm install rollup --save-dev

These plugins (rollup-plugin-commonjs & rollup-plugin-babel) have rollup listed as their peer dependency:
https://github.com/rollup/rollup-plugin-commonjs/blob/master/package.json#L24
https://github.com/rollup/rollup-plugin-babel/blob/master/package.json#L38
Currently peer dependencies are not searched among global packages. I'm not sure what are the reasons behind it. See also:
https://github.com/npm/npm/issues/9857

Related

How to install NPM end-user packages on NixOS?

Is there a way to install NPM command line tools on NixOS?
[root#ip-xxx-xxx-0-27:~/teros/ntrs-cli]# sudo npm i -g typescript
npm WARN checkPermissions Missing write access to /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! path /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! code EROFS
npm ERR! errno -30
npm ERR! syscall access
npm ERR! rofs EROFS: read-only file system, access '/nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
I assume because it's read-only, because I did run:
chown -R `whoami` nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1
as an aside if someone knows how to install Node.js version 11 or 12 on nixos that'd be great.
Firstly, please undo the permissions change (chown) you made. You should NEVER change the permissions of files in the Nix store (/nix/store).
To install NPM packages on NixOS use the corresponding Nix package, instead of using npm -g .... NPM packages are under the nodePackages "namespace".
For example, to install typescript (tsc) edit /etc/nixos/configuration.nix:
...
environment.systemPackages = with pkgs; [
...
nodePackages.typescript;
]
...
Then use nixos-rebuild switch to "install" the package.
You can install Node.js the same way. Use nix search nodejs to see the various versions you can install.
Instead Edit ~/.npmrc so that it tells npm to install and find "global" packages in your home folder instead of the root location:
prefix=~/.npm-packages
now any time you run npm i -g <some-package> you will see that it will be installed inside of ~/.npm-packages.
Now in your shell rc file (f.e. .bashrc or .zshrc or similar), you'll need to update your PATH to include executables from the new location:
### Add NPM executables to your PATH so that they are available as commands:
export PATH="$HOME/.npm-packages/bin:$PATH"
Often it is more convenient to manage ephemeral dependencies outside of the system-level package manager.
If you use something like n or nvm to manage specific node versions, you can do a similar thing by managing them in your home folder.
npm config set prefix '~/mutable_node_modules'
This thread should be helpful:
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-50330167
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-187510024
You can also install them with the usual npm -i..., just without the -g (global) paramater.
looks like things may have changed a bit.
on fish shell with node v16.15.0 and nix (Nix) 2.8.1. I just had to add fish_add_path -g $HOME/.node_modules/bin to my config.fish then npm install -g <package>.

ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0

I get that message every time when trying to install zapier-cli.
Can someone help me with solving the issue?
I think you need to manually install ajv or update it to version 6 if you already have a lower version installed
npm i ajv
I had a similar issue so I installed it manually and everything worked for me
David here, from the Zapier Platform team. It looks like this is a bug with npm itself. Updating npm (npm i -g npm) or manually installing ajv (npm i -g ajv#6) should resolve the warning.
Problems: npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is installed.
You must install peer dependencies by yourself.
You missed the dependencies of ajv#^6.0.0
Just install it :
npm install ajv#^6.0.0

React-native#0.26.3 requires a peer of react#15.0.2 but none was installed

I am trying to set up for the react native. but whenever I update files it gives m error
enoent ENOENT: no such file or directory, open 'React Native/package.json'
npm WARN react-native#0.26.3 requires a peer of react#15.0.2 but none was installed.
npm WARN React Native No description
npm WARN React Native No repository field.
npm WARN React Native No README data
npm WARN React Native No license field.
MacBook-Pro:React Native$ npm info react dist-tags.latest
Please let me know how can I fix.
Installing react should fix the error
npm install react --save
Also, you may try upgrading your react-native install. react-native is as v0.30.0 now
npm update react-native
In my specific case I was running npm install in the wrong directory. I thought I was in my project directory but was one level higher. This meant react was missing from installed packages (because there were none) and thus gave this error.
Some steps that worked for me:
1. watchman watch-del-all
2. rm -rf node_modules
3. npm install react#15.0.2 --save
4. npm install react#15.1.0 --save
5. npm install
6. rm -fr $TMPDIR/react-*
7. npm start -- --reset-cache
In my case, the project I am working on requires a specific version of React. Since it was older than the current release, doing an install/update would still cause the error.
In order to fix the problem, I had to check the package.json of the project and install the exact version allowed by the dependency definition. In the OP's case, a
npm install react#15.0.2
should fix the problem by installing the exact version of the React module that react-native requires.
Verify that the condition was resolved by doing a npm list to see if there are any other unmet peer dependencies.

Getting npm Err! tar.unpack while setting up cordova environment

I followed this tutorial to install yeoman, bower, grunt to setup angularjs corodva project. http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/
as it says i installed everything but still it gives me error! while creating angular project.
I did,
My PC is running windows 8.1 64 bit
Install node.js using windows installer (64 bit)
Install git (selected windows commandline instead git bash while installing)
npm install -g yo grunt-cli bower
I cross checked everything whether it is installed
C:\Windows\system32>yo --version && grunt --version && bower --version
yo - 1.4.7
grunt-cli v0.1.13
bower - 1.4.1
4. npm install -g generator-angular
created a dir in c and installed yo angular
C:\test\yo angular
It asked for sass (i given NO), bootstrap (YES), other angularjs library (NO) then it started installing
then after sometime, it asks that my package.json should overwrite i gave yes
after the few files generated then shows ERR!
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/brace-expansion/1.1.0/package.tgz
npm ERR! tar.unpack untar error /root/.npm/delayed-stream/0.0.5/package.tgz
npm WARN optional dep failed, continuing form-data#0.1.4
npm ERR! tar.unpack untar error /root/.npm/is-property/1.0.2/package.tgz
npm WARN optional dep failed, continuing request#2.54.0
As Prasanth says, The best way is to do the following:
npm cache clean
double checked whether everything is installed
also try close then re-open cmd as administrator
When angular asks for overwrite package.json, Say n to all
Still faces issue, then try this
make sure Grunt is installed
npm install (it will install missing packages)

Managing bower dependencies with ionic

After starting with a new ionic app, I can see at bower.json that comes with ionic is in devdependencies. Why is it a devdependency and not a normal dependency?
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-rc.0"
},
Thanks, I feel confused right now
having devDependencies gives you the opportunity to simplify the steps that drive you from the source files (a git clone of the project) to the production ready app
when you don't need to make changes and (develop) the application, you could just run
bower install --production
or
npm install --production
they work the same
bower install options
-F, --force-latest: Force latest version on conflict
-p, --production: Do not install project devDependencies
-S, --save: Save installed packages into the project’s bower.json dependencies
-D, --save-dev: Save installed packages into the project’s bower.json devDependencies
-E, --save-exact: Configure installed packages with an exact version rather than semver
bower documentation
npm install options
By default, npm install will install all modules listed as
dependencies. With the --production flag (or when the NODE_ENV
environment variable is set to production), npm will not install
modules listed in devDependencies.
npm documentation
This way you take less time to ship the app and don't waste bandwidth downloading stuff you won't need.
Given that, to me, the choice of listing ionic as devDependecy is a poor one: it implies that I could take advantage of this choice to get ready the app for execution this way:
git clone my-project
git cd my-project
npm install --production # ionic not installed here
ionic state restore
ionic build ios
Now, if you ignore the content of /lib folder in your sources, this should not work, and if it works because the ionic-cli does some more checks to save your ass, I think this is unclear.
From what I understand, dependencies are required to run, and devDependencies are only for development, like minification, unit tests, etc.
Both will install when you do npm install but only dependencies will install when you do npm install $package, unless you add the --dev option

Resources