I'm on Mac OSX and I've been trying to use Node.js with Crawler. Now i've just installed following steps as it instructed:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
curl http://npmjs.org/install.sh | sh
npm install crawler
As soon as i've installed the last one (Crawler), when i test run the test/simple.js as in its sample, i'm getting following errors:
The "sys" module is now called "util". It should have a similar interface.
http://jamendo.com/
http://tedxparis.com
/crawler/node_modules/crawler/lib/crawler.js:74
response.body = body;
^
TypeError: Cannot set property 'body' of undefined
at Object.callback (/crawler/node_modules/crawler/lib/crawler.js:74:39)
at Request._callback (/crawler/node_modules/crawler/lib/crawler.js:70:43)
at /crawler/node_modules/crawler/node_modules/request/main.js:119:22
at Request.<anonymous> (native)
at Request.emit (events.js:67:17)
at Object._onTimeout (/crawler/node_modules/crawler/node_modules/request/main.js:532:12)
at Timer.ontimeout (timers.js:84:39)
This means the Crawler doesn't work yet. How can i fix it?
You have a few options:
Try a newer version of Crawler
Use an older version of Node
Use a different module (recommended, as Crawler is very out of date)
Fix Crawler yourself (and submit your patches!, but it seems nobody is maintaining this project anymore)
If this is just a one-time error, you can wrap the whole thing in a try/catch and handle it as needed.
You may also be interested in trying my Node Crawler (https://github.com/ecdeveloper/node-web-crawler). It's not a module but an independent web app. It uses Mongo, Express, Socket.io, Twitter bootstrap.
Related
Trying to run the following Google Maps API example locally with this command:
npx #googlemaps/js-samples init directions-waypoints googlemapssample
But everytime I try to run the npx command locally, it fails after a few seconds and I get the following error:
TypeError: must call as: npm.load(callback)
at Object.load (C:\tmp\nodejs\npm-cache\_npx\33944\node_modules\#googlemaps\js-samples\node_modules\npm\lib\npm.js:123:13)
at Object.main [as handler] (C:\tmp\nodejs\npm-cache\_npx\33944\node_modules\#googlemaps\js-samples\cli\index.js:84:9)
I have npm version npm version 6.14.5 and node version 14.4.0. Don't really understand why I am getting this error.
Apparently they're using a deprecated call to the npm.load(options, callback) method. NPM seems to expect only one callback argument (without an options argument).
My guess is that few people try to run it this way. I don't know if this cryptic Issue was opened to fix this problem: https://github.com/googlemaps/js-samples/issues/335
I can see many posts on this problem, but no one answers the simple question.
I want to type
express myNewProject
on a system running node V12.16.2
All the replies get into WHY it fails, such as "fs.writeFile(...) requires a third (or fourth) parameter"
Am I really forced to not use express any more? Is there some fix I can apply to my system and make this work?
here is the session:
bcuser#autumn14:~$ express myNewProject
create : myNewProject
install dependencies:
$ cd myNewProject && npm install
run the app:
$ DEBUG=myNewProject ./bin/www
fs.js:144
throw new ERR_INVALID_CALLBACK(cb);
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received { mode: 438 }
at maybeCallback (fs.js:144:9)
at Object.writeFile (fs.js:1252:14)
at write (/usr/lib/node_modules/express-generator/bin/express:246:6)
at /usr/lib/node_modules/express-generator/bin/express:210:5
at /usr/lib/node_modules/express-generator/bin/express:261:11
at /usr/lib/node_modules/express-generator/node_modules/mkdirp/index.js:29:20
at FSReqCallback.oncomplete (fs.js:155:23) {
code: 'ERR_INVALID_CALLBACK'
}
This error looks like you need to update either express or express-generator to the latest version. You're on Express 4.9.0 and the latest is 4.17.1. The error stack looks like it's referring to express-generator, but perhaps it's a version of Express embedded into the express-generator install. In either case, I think you need a newer version.
As for background, starting in node.js v10, node started requiring asynchronous callbacks on a number of asynchronous functions such as fs.write() and fs.unlink(). So, any code that was kind of doing fire and forget calling of those functions without paying any attention to the completion or error (by not providing a callback function) would generate this ERR_INVALID_CALLBACK error.
Can someone please advise - how to resolve this? This setup works fine locally on Windows 7 laptop, but fails on Windows 2008 server.
Here is the setup:
1. Using ASP.NET Core App and NodeServices on Windows Server 2008.
2. Installed Node.js and NPM on the server.
Logged in as one of the admin accounts "xyz". When I install a npm module - in this case, cypress test framework, it installs under the path:
C:\Users\xyz\AppData\Local
But when I run the application, it looks for the module under the path:
C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\
The application fails, complaining that the module is not found.
Things I tried so far:
1. Copied the cypress module directly from user localappdata folder to above location. Then it works.
2. Tried giving full path to the var cypress = require('cypress') - it finds the module, but whenever we try to use cypress, gives the same error.
3. Tried changing the nom prefix as well as cache location to the above path, but npm install cypress always installs under user's localappdata path only.
Any ideas on how to - either make the npm install, install the module at desired location. OR make the application look at the desired path?
Thanks a lot.
Here is the error:
An unhandled exception occurred while processing the request.
NodeInvocationException: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
Error: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
at raise (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\errors.js:161:13)
From previous event:
at C:\inetpub\wwwroot\EmbeddedDashboard\node_modules\cypress\lib\errors.js:169:37
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:48:60
From previous event:
at checkExecutable (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:43:11)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:213:12
at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:212:6)
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\exec\run.js:130:19)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:29:19
at _fileCreated (C:\inetpub\wwwroot\projectTest\node_modules\tmp\lib\tmp.js:246:7)
at FSReqWrap.oncomplete (fs.js:82:15)
From previous event:
at Object.run (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:26:28)
at module.exports.cypress.run.then (C:\inetpub\wwwroot\projectTest\Scripts\RunTests.js:4:13)
at C:\Windows\TEMP\mecqsmig.e5o:166:18
at IncomingMessage.<anonymous> (C:\Windows\TEMP\mecqsmig.e5o:186:37)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.InvokeExportAsync<T>(NodeInvocationInfo invocationInfo, CancellationToken cancellationToken)
Cypress uses cachedir to find the correct location to install Cypress into. C:\Windows\System32\config\systemprofile is the home folder of the SYSTEM user on Windows. Somehow, npm install is being executed as SYSTEM, not as your user. This would cause Cypress will attempt to install to SYSTEM's %APPDATA% directory, which is C:\Windows\System32\config\systemprofile.
This would make sense, according to the system requirements of Cypress:
Windows 7+, only 32bit binaries are provided for Windows.
I figured out how to resolve this. For some reason, when I run the application, even though it is configured to run under a service account, it still kept using the default system location for cache location.
You can configure the cache location of Cypress by setting an environment variable to your desired location. That resolved the issue for me. Here is the link to it: https://docs.cypress.io/guides/getting-started/installing-cypress.html#Binary-cache
Basically, you set a value to this environment variable CYPRESS_CACHE_FOLDER and you are set.
Hope this helps someone.
I am creating a panel in Adobe Premiere Pro which used Google Cloud speech. I am accessing google-cloud/speech on the Javascript side, not JSX side via NodeJS. I am also accessing google-cloud/storage. No big deal, I installed NodeJS on a Mac and functions accessing google-cloud/storage were easy to code.
After following the instructions to npm --save #google-cloud/speech and npm --save #google-cloud/storage, it created the node_modules directory. I have moved them to a custom directory but they are duplicated in the standard location also.
In my code, I reference them as per the google-cloud examples:
// note cep.node is required in the Adobe CEP environment to access nodejs
const speech = cep_node.require(extention_path+'/lib/node_modules/#google-cloud/speech');
const project_id ='project_id_xxx1234';
const keyFilePath = extention_path +'/path/to/key.json';
const client = new speech.v1.SpeechClient({
projectId: project_id,
keyFilename: keyFilePath,
});
I've tried this w/o the ids and speech.SpeechClient() etc as per examples. The methodology is working fine with google-cloud/storage, so I know the similar downloaded node modules at the same location work fine for that.
However, it fails on trying to make a new speech.SpeechClient() with the browser debug error below.
Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v51-darwin-x64-unknown
Found: [.DS_Store, node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v51-darwin-x64-unknown/grpc_node.node'
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (module.js:595:32)
at Object.Module._extensions..js (module.js:610:10)
at Module.load (module.js:512:32)
at tryModuleLoad (module.js:471:12)
at Function.Module._load (module.js:463:3)
at Module.require (module.js:522:17)
at require (internal/module.js:20:19)
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/client_interceptors.js:145:12)
at Module._compile (module.js:595:32)
My belief is that these series of node_modules that are accessed by #google-cloud/speech were compiled use NODE_MODULE_64 and need 51 (instead).
$ npm rebuild rebuilds (or checks current version of the modules) fine with the exception
protobufjs#6.8.8 postinstall /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/protobufjs
node scripts/postinstall
grpc#1.14.1 install /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc] Success: "/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
So some module needs v51 instead of the build v64. The question is can the #google-cloud/speech modules be built using v51 and how? or do I wait for google-cloud to come up with a solution? BTW: I also renamed the node-v64 dir to node-51, but received another error referencing the MODULE 51. Any direction would be appreciated.
Some of the dependencies for #google-cloud/speech are native addons. Those being C/C++ code, they need to be compiled for the correct Node version. Looks like your Node version that you used for npm install doesn't match the one in Adobe CEP. Switch to Node 5.1 and run npm install or npm rebuild again.
I recommend using nvm to change Node versions, see Node Version Manager.
I am having trouble using the Cloud9 IDE to run files which use bonescript on a BeagleBone with the pre-installed version of Angstrom Linux. I am using Cloud9 at http://beaglebone.local:3000 in Chrome 18 on OSX 10.7.
When I run the Bonescript blinkled.js sample code Cloud9 outputs this error:
Output
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/var/lib/cloud9'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at Array.<anonymous> (module.js:430:10)
at EventEmitter._tickCallback (node.js:126:26)
If I try adding a file path in the run configuration as suggested in this StackOverflow question I get this error in the Console (in bright red mind you):
[C9 Server Exception 2] undefined
At this point Cloud9 also stops responding and I have to reload the page to attempt to use it further.
If I add "blinkled.js" as the file path I get this error:
'inotify' not loaded
If desired, try installing it with:
curl http://npmjs.org/install.sh | bash
npm install inotify
'fibers' not loaded
If desired, try installing it with:
curl http://npmjs.org/install.sh | bash
npm install fibers
Delay operations loops will consume CPU cycles
Invoke using 'node-fibers' if node version < 0.5.2
No idea what I should put in there.
I've been Googling these various errors for about 24 hours now.
This seems like a great tool, if I can only get it to work. Any ideas?
UPDATE 1
After realizing the opkg had failed to load the required inotify and fibers packages I installed them manually and tried again. Now I get this error on the command line:
# node blinkled.js
gpio: 38 already exported.
{ [Error: EBUSY, resource busy or locked] errno: 10, code: 'EBUSY', syscall: 'write' }
Unable to export gpio: 56
Now I realize there were multiple problems:
First, I should have checked the documentation to get node.js to work. I just assumed alert() was a function when I should have been using console.log(). So once I realized this I was able to run this file in Cloud9:
var hello = "hello world"
console.log(hello);
Second, When I tried to install the libraries (inotify and fibers) using the npm package manager it placed them in the node_modules directory in my working directory:
/home/root/
... not the default Cloud9 root directory as I assumed it would:
/var/lib/cloud9
Third, my pins were already exported, which was fixed by simply restarting the BeagleBone.
Finally, I found that creating a new instance in my home directory with the latest version of bonescript allowed me to run the blinkled.js sample file, as well as this file which tests all analog pins on the BeagleBone from the command line.
You might do a 'git pull' in /var/lib/cloud9 to get an update. One thing I've added is an 'analogRead' function.
i bough beagle bone rev. A4. this kind of error is comming on that also.
i have just make new SD card with latest angstrom image, and then after blinky is working properly.