I am developing a schematics collection for #angular/cli. I would like to test locally how it is working.
Is it possible to test ng-add CLI feature locally?
After linking project with npm link and running ng add myFeature, #angular/cli tries to download the desired library from the npm, what causes following issue:
npm ERR! code E404
npm ERR! 404 Not Found: myLibrary#latest
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mtreder/.npm/_logs/2018-05-09T10_13_58_291Z-debug.log
Package install failed, see above.
Package install failed, see above.
Can I somehow mock, npm registry to my local environment?
You can use verdaccio to mock a local registry and publish your own stuff and resolve the remaining dependencies from npmjs.
https://www.verdaccio.org/
Here some answer might helpful for you.
Private and Public NPM Package Install in Single Command
I'm not sure whether this 100% answer your question, but, I hope it helps.
Related
I am trying to install GLOBALLY a package with npm from my home directory. After the install has completed, it indicates vulnerabilities. Upon trying to run npm audit fix, I obtain the following error.
npm ERR! code ENOLOCK npm ERR! audit This command requires an existing
lockfile. npm ERR! audit Try creating one first with: npm i
--package-lock-only npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
I understand that the error asks me to run npm i --package-lock-only, but in which directory should I be creating this file? Running the command without specifying a path does not work. I have also tried to create the file in the directory where the package was installed, but that has also not solved the issue. Also, why isn't this file present to start with?
npm audit fix is intended to fix vulnerabilities with the dependencies of your own project. Projects do have a package-lock.json file.
It is not intended for globally installed packages. If there are vulnerabilities with packages from others, they need to be fixed by the package maintainer in a new release. You can then update to this new release.
BTW, you should not use globally installed packages. Use npx instead.
I'm having an issue with the create-react-app command. I've followed the instructions twice, tried other solutions such as adding
"resolutions": {
"ajv": "6.8.1"
}
to the package.json file then uninstalling and reinstalling ajv#6.8.1. I've tried using yarn but ended up just starting it all over to use npm, just to get the same error. Most answers I am finding are a year or more old. any help is Appreciated!
Here is the error message..
npm start
scilenceapp#0.1.0 start C:\Users\chris\OneDrive\Documents\coding stuff\SciLence\ScilenceApp\scilenceapp
react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.42.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
C:\Users\chris\node_modules\webpack (version: 4.41.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\chris\node_modules\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scilenceapp#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scilenceapp#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\chris\AppData\Roaming\npm-cache_logs\2020-07-27T21_42_25_489Z-debug.log
PS C:\Users\chris\OneDrive\Documents\coding stuff\SciLence\ScilenceApp\scilenceapp>
“C:\Users\chris\node_modules\webpack (version: 4.41.2)”
You may have to remove that file from your c drive. And run npm i again. I had the same issue with jest.
try also npm cache clean --force
I'm trying to adapt an external API named cric-live into my node application for displaying cricket scores in my application. When I try to install the dependency, it shows an error as below
PS F:\Node Express\NodeJS\cric api> npm i cric-live
npm ERR! Unexpected end of JSON input while parsing near '...":"request-promise","'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Thiluxan\AppData\Roaming\npm-cache\_logs\2020-07-01T04_51_42_400Z-debug.log
This is the source link for the dependency I'm trying to install
https://www.npmjs.com/package/cric-live?activeTab=readme
Your npm cache maybe busted so I would say run this code first and try installing the package again
npm cache clean --force
C:\Users\Jorge\Desktop\space-xplorer>npm install
node-sass#4.11.0 install C:\Users\Jorge\Desktop\space-xplorer\node_modules\node-sass
node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jorge\AppData\Roaming\npm-cache_logs\2020-01-23T22_44_17_513Z-debug.log
This issue is coming because of compatibility issue of node version and node sass version.
You need to downgrade node version to 10 to install node sass 4.1.0. It is not compatible with version 12 of node.
See this discussion for the same issue.
Compatible versions are listed on the readme https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimium-support
Following 2 lines of code will resolve this error
npm run build
npm start
you should ask a question and provide some explanation, not just throw an error up and expect an answer. But I've seen this before:
Basically NPM is trying lacking a dependency for loading node-sass, and its fallback is to get the file it needs from github.
Looks like you're behind a firewall that blocks you from direct access to github, but all you actually need is that file bindings file.
You would have to have a proxy server that is allowed to access github, or download the binary file yourself.
I downgraded the node from 14.8 to 12.18.3, but it did NOT solve the problem.
but after that, as crazy as it is may sound, I deleted the package-lock.json and tried to install the package again and solved the problem.
I am getting below error while installing angular cli.
Please help me
C:\Users\A737539>npm install -g #angular/cli#6.1.3
npm ERR! code E502
npm ERR! 502 Parent proxy unreacheable: #angular/cli#6.1.3
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\A737539\AppData\Roaming\npm-cache\_logs\2018-11-21T09_33_42_128Z-debug.log
Thanks,
Pushkar
Here is how you can get npm work when on a proxy network :
create a .npmrc file with below fields :
registry= //local artifactory site if any - remove if not
strict-ssl=false
cache=.\npmcache
prefix=.\npm
package-lock=false
loglevel=verbose
proxy= http://domain\username:password#servername:port/
https-proxy= http://domain\username:password#servername:port/
unsafe-perm=true
sass-binary-site= // if any local binary site is present - remove if not
Now place this file into mentioned location : C:\Users\A737539> and then
run npm install command it will work.
Once done , You can place this file inside repository (any new app created using cli) so that each time you don't have to set proxies manually.