I am trying to install twilio for nodejs. These lines are coming up in console.
npm WARN twilio#0.4.0 package.json: 'modules' object is deprecated
twilio#0.4.0 ./node_modules/twilio
How to get rid of this ?
I am using npm install twilio command.
I tried to download and copied in node_modules folder but that is not working.
This has to do with the package.json file which is a specially formatted file used for the npm package management system. Certain values are required and some of those key names have changed over the years and some just have been removed. The error you are getting is due to the package.json file still using the modules key:
},
"modules": {
"client": "./lib/twilio",
"twiml": "./lib/twiml"
},
https://github.com/sjwalter/node-twilio/blob/master/package.json#L13
Even though you are getting this error it should not effect your usage of the module. It was still installed and everything should work just fine.
There's an open bug report for this, but it doesn't seem to have gotten much attention.
Related
I am trying to deploy a function to Google Cloud Functions. I based it on their ImageMagick tutorial.
Every time, the function fails to deploy because it reaches an error. Looking at the log, the error is:
Provided module can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace:
Error: Cannot find module 'sharp'
I can't figure out why this is happening, because sharp is in my package.json dependencies. If I open the web editor for the function in the Google Cloud console, the package.json is there as one of the files and shows sharp as a dependency. I tried running npm install and npm install --save and re-deploying, and that hasn't fixed anything.
I'm including the package in the function with const sharp = require('sharp'); (this is the line where the log shows the error occurring), and this is my package.json:
{
"name": "Resize images",
"version": "0.0.1",
"private": true,
"author": "James Tyner",
"engines": {
"node": ">=10.0.0"
},
"dependencies": {
"#google-cloud/storage": "^5.0.0",
"sharp": "^0.25.4"
}
}
Can you help me figure out what I'm doing wrong?
This has happened to me many times since I was tricked to install packages in the project directory. It works fine locally but creates an error when you try to deploy.
It worked for me when I changed directory into the functions folder, instead of the firebase project folder and did a package install in there
cd functions
npm install [your missing package] --save
I was running into this issue. Various dependencies were causing my function deployment to fail. After a bit of digging I found that the peer-dependencies were not being included.
Adding this fixed my issue
"scripts": {
...
"gcp-build": "npm i npm-install-peers"
},
checking the docs.
the gcp-build command allows us to perform a custom build step during the function build process.
Somehow I was able to address the issue, but I don't fully understand what I did differently. I found that the dependencies listed in package.json weren't being installed when I ran npm install, so I created a separate folder and copied my code there, ran npm install in the new folder, and it worked well from there. Since then, the dependencies have been working properly when I change them and re-deploy the function.
Using Node v12.13.1 and serverless deployment with webpack to GCP and cloud-functions, I've struggled with this issue. In my case it was a different module though. The problem is that no module from node_modules will be possible to require or import. The reason becomes clear if one takes a look at the webpack zip-file in directory .serverless. It seems that with GCP nothing but the file (typically index.js) denoted as "main" in package.json is actually included.
The solution was to adapt webpack.config.js to explicitly include those files missing.
webpack.config.js
I have the weirdest problem I've ever seen with npm where in the middle of running an angular ng serve, packages from both node and for angular will randomly go missing. In the middle of a save, the project will suddenly not recompile, and will complain about a missing module. Each time it has been different but so far I have had:
Error: ENOENT: no such file or directory, open '.../node_modules/core-js/internals/hidden-keys.js'
Module not found: Error: Can't resolve '../internals/is-pure' in '/.../node_modules/#angular-devkit/build-angular/node_modules/core-js/internals'
An unhandled exception occurred: Cannot find module './internal/streams/stream
An unhandled exception occurred: Cannot find module '/.../node_modules/minipass-collect/node_modules/minipass/index.js'.
Please verify that the package.json has a valid "main" entry
These have just been errors from the last few days, but issues like this has been happening all. to the point where I need to delete node_modules and reinstall everything via npm at least once a day. I'm thinking the error has more to do with node or NPM than with my Angular set up, as some of these missing packages appear to be node core packages.
I've already tried reinstalling npm globally via npm install -g npm and it hasn't helped anything. I'm afraid that I'm going to have to just reinstall node completely.
Any help would be appreciated, thank you.
EDIT: upon further debugging, I'm noticing that the modules missing are always from #angular-devkit/build-angular/node_modules/core-js/modules. In addition to losing random modules like 'is-pure', the app will also randomly recompile many times when running ng serve
I figured out what was going on, if anyone in the future has the same problem. Turns out the answer has nothing to do with me botching my npm config. I didn't realize that on new Macbooks, any directory in the desktop is automatically managed by iCloud. At some point, probably an older version of the code before I migrated to Angular 9 was syncing the old code into my project. I was able to resolve this issue by changing the name of the parent directory where my project lived from filename to filename.nosync. adding '.nosync' causes iCloud to ignore syncing for whatever is in that file. I know I should have caught this, but hopefully this will help any mac users in the future who are experiencing similar problems.
I'm fairly new to the linux webapp development scheme but there was a readme attached with the project that the previous team left me.
It said I have to call
sudo npm install
bower install
grunt build/grunt server.
firstly, my bower.json is empty with the exception of
{
"name": "webapp",
"dependencies": {
"roslib": "~0.15.0"
}
}
and secondly when I call grunt build I get the error
error Parsing error: Unexpected token let
I also get the same error with the tokens '<' and 'ILLEGAL'
Edit: I found that grunt build is defined as
grunt.registerTask('build', ['eslint', 'browserify', 'concat_css', copy']);
You should talk to the previous team and ask them about the project and get some rampup. You should probably also do at least a few tutorials on node/grunt/whatever else they're using.
As for your issues, firstly there's nothing wrong with the bower.json only having one dependency, that's not an issue. Bower seems to be declining though so you could also get roslib through npm, though you'd have to understand enough about the project to replace where it's being used to be from node_modules.
You're probably getting the error on grunt because they've used let in their Gruntfile.js and you're on an old version of node that doesn't support let yet. The latest long term support of node.js is 6.10.3. I would update if you can.
I am attempting to install localForage into a node.js application (with Angular) and Browserify.
Here is a link to the localForage documentation
It appears that using localForage and angular-localForage causes a problem with browserify based around the use of 'require'
If I require the localforage.js file in the src file I get the following error:
Warning: module "promise" not found from "/Users/mgayhart/Sites/epson- receipts/bower_components/localforage/src/localforage.js" Use --force to continue.
If I require the localforage.js file in the dist file, I get the following error:
Warning: module "./drivers/indexeddb" not found from "/Users/mgayhart/Sites/epson- receipts/bower_components/localforage/dist/localforage.js" Use --force to continue.
Anyone know of a workaround to be able to move forward with these libraries?
There is an issue on github with this problem: https://github.com/ocombe/angular-localForage/issues/26
I'll be working on it soon, you can subscribe to the github notifs on this issue to know when it's fixed !
For me installing it through bower and using it with browserify-shim worked. So in package.json:
"browser": {
"localforage":"./src/lib/vendor/localforage/dist/localforage.min.js"
},
"browserify-shim": {
"localforage":"localforage"
}
And to expose it as an angular-service (if you don't want to use angular-localforage):
app.factory "localforage",-> require 'localforage'
I've just been having this issue myself tonight, but I think I found a fix.
Instead of trying to get the bower modules to work with browserify, why not just use npm like its made for?
npm install localforage
and then when you use require you don't have to give it the path
but it still didn't work for me until I copied the folder:
localforage/src/drivers TO localforage/dist/drivers
Then it found all the dependencies and worked like a champ!
Alternatively if you must use bower you could try to use the debowerify tranform w/ gulp:
https://github.com/eugeneware/debowerify
I can't install any node.js module without the follwing errors popping up. The error codes refer to the package.json file. Any idea why this would be happening would be hugely appreciated.
Those are not errors, they are just warnings. Everything is as it should be, though the module owners should probably clean up their package.json files.
Those are not errors, are warnings.
As I already stated in the same question right here, this is just a new check added as of NPM 1.2.20.
There are so much packages in NPM that still lack the repository field in their package.json file.