I am using cheerio module for web scraping . It require htmlparser2 module , after installing htmlparser2. it gives following error-
Error: Cannot find module 'entities/lib/decode_codepoint.js'
Use this in your terminal:
npm install grunt-contrib-jshint --save-dev
Seen here:
https://www.npmjs.com/package/grunt-contrib-jshint
Below is applicable to Windows environment only, not Linux.
I received the same error when I tried to build jquery from source on Windows. It turns out that jsdom and/or grunt-contrib-jshint (both of which depend on htmlparser2) require gyp and for gyp to work you need a c++ compiler and python. I thought that I had them but turned out, that python need to be version 2.x not version 3.x. If it is 3.x it gives you a proper error on the first run (that I missed) and on subsequent runs you are getting the error in the question above which makes you wonder what's going on.
So I uninstalled python 3.x, installed python 2.x (don't forget make sure that python.exe is in your path), then deleted the node_modules folder in the project root and ran the build again.
This time around it worked. I'm not sure if this solves the OP question, but I hope it helps someone.
Related
Hello I am currently stuck with a task that is given to me. The problem is that I am unable to install dependencies when running npm install which means that I am unable to run the website locally which is my main goal
There are many versions of this question in the internet but I am not really sure what the main cause of this therefore the title of this question
you can view my error logs here
https://www.codepile.net/pile/4qL4NOq0
I have also tried some solutions that I have seen on the internet such as:
reinstalling node
deleting node_modules and package-lock.json and re-npm install (this is when I have installed the node_modules but still unable to run the website locally)
installing grpc globally
The version of grpc that you are installing (1.23.3) does not support the version of Node.js that you are using (16). You will need to use a newer version of grpc (the latest is 1.24.11) or an older version of Node to get that to work.
Please note that the grpc package has been deprecated in favor of the #grpc/grpc-js package. It is recommended that you use that one instead if possible.
I'm using Twig as my templating system on server side and also want to use it client side (to use the same templates).
I'm also using Bower and tried this command to get Twig.js:
bower install twig.js
But that didn't install all folders as seen here https://github.com/twigjs/twig.js. Then I tried to install other recent branches and commits but still 2 folders were missing at least (bin & src).
After that, I tried cloning the project using Git and it worked because it really got all listed files and folders.
But then when I include twig.js in my HTML file throws this error in the Chrome console log:
twig.js:13 Uncaught ReferenceError: require is not defined
My best guess is that function "require" belongs to Node.js (right?) and there must be some kind of compilation to get Twig.js for the browser (right???).
So, I don't know what is next... How can I get the Twig.js for the browser? (Meanwhile I'm going to get Twig.js from a CDN).
Please help me.
I don't know which version of Twig.js you were using, since the question was posted almost 2 years ago, but probably something 0.9.x or higher. Since that version the maintainers did not commit any JS files compiled for web usage in the root of the project.
So yes, the JS files inside the src/ folder are NodeJS files and you have 'to do something' before you can use them in your browser. The library is using Webpack to build a browser compatible version.
You should run npm install in the root of the GitHub clone to set up the project and then run npm run build in order to build a web version. Check for twig.js in the root after that.
Using a CDN version is also a good option. But because the builds were left out since version 0.9.0 there is no newer version of Twig.js on cdnjs than 0.8.9 while the library is currently on version 1.12.0
Or run npm install twig --save, the compiled files are at:
node_modules/twig/twig.js and
node_modules/twig/twig.min.js
You have to install RequireJS to use require("twig");. Install that first and then run.
I want to query a hive database table from node js. I searched in npm and found two packages - node-hive and thrift-hive, but problems with both as follows
1) node-hive: When I try to run using this, there are many missing dependencies finally didn't get the module 'thrift/transport'
2) thrift-hive: When I try to run using this, query is running forever and not even doing a timeout. I suspect that the libraries they used are for old versions of hive.
The version we are using for hive is 1.1.0-cdh5.4.1.
Is there anything I am missing or is there any proper hive connectors in npm. Thanks in advance
If you want to resolved that dependencies issue then you need to first install thrift module with 0.9.1 version.
So add "thrift":"0.9.1" in your package.json and run npm install.
After that you will not get 'thrift/transport' module dependencies error. Furthermore, even I am curious to know about which npm is best suitable to connect to hive. I am using node version 0.12.7.
I am trying to reinstall node. I was screwing around a little bit trying to download a newer version.
So to uninstall I cleared out the node and node_module parts inside usr/local/bin/ and usr/local/src
Following these instructions
https://github.com/joysent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint
When I run
xx.x#x:~/src/node-v0.10.18$ checkinstall
I get
dpkg: regarding .../node_0.10.18-1_i386.deb containing node:
nodejs conflicts with node
node (version 0.10.18-1) is to be installed.
node provides node and is to be installed.
dpkg: error processing /home/hassan/src/node-v0.10.18/node_0.10.18-1_i386.deb (--install):
conflicting packages - not installing node
Errors were encountered while processing:
/home/hassan/src/node-v0.10.18/node_0.10.18-1_i386.deb
(END)
I am not sure what else I should be doing. I tried a few other things.
:(
More details
This is what shows up on the command line
Copying files to the temporary directory...OK
Stripping ELF binaries and libraries...OK
Compressing man pages...OK
Building file list...OK
Building Debian package...OK
Installing Debian package... FAILED!
*** Failed to install the package
Do you want to see the log file? [y]: y
*** SIGINT received ***
Restoring overwritten files from backup...OK
Cleaning up...OK
Bye.
OH I solved it! I deleted all of the node related files through synaptic !! :D!
You may be able to use my pre-built packages which are available here:
https://launchpad.net/~chris-lea/+archive/node.js
They install a /usr/bin/nodejs binary and then create a symlink from that to /usr/bin/node.
If you are going to use these, be sure to remove any vestiges of any previous installs so that the system is using the correct binaries.
I have got a Nodejs app on AppFog and want to connect to a ftp-server with this.
I did install it with npm install ftp using "Ruby Command Prompt"
This is the only code line:
var FTPClient = require('ftp');
Trying to start the app, it throws an error:
Skipping npm-support: npm-shrinkwrap.json is not provided
Which kind of server should I use or what's the problem?
Still doesn't start:
Starting Application 'test007': .
Error: Application [test007] failed to start, logs information below.
====> /logs/staging.log <====
# Logfile created on 2013-03-09 10:37:09 +0000 by logger.rb/25413
Installing dependencies. Node version 0.8.14
Installing ftp#0.2.9 from local path
Installing xregexp#2.0.0 from local path
Installing node#0.0.0 from local path
Installing nodejs#0.0.1 from local path
But no error is shown.
Thanks in advance
The quick fix is to type npm shrinkwrap, which will provide an npm-shrinkwrap file.
A shrinkwrap file fixes the exact versions of your dependencies, and the exact version of their dependencies, and so on. Without it, each usage of npm install could install different versions of the packages -- sometimes, just different bugfix versions (1.4.2 vs 1.4.3), but sometimes much greater differences. There's no guarantee that your code will work with different dependency versions (in fact it is not uncommon to break), so shrinkwrapping is a great idea for any production-level code.
If you want to 'unshrinkwrap', just delete the npm-shrinkwrap.json. You can re-shrinkwrap at any point.