I haven't found any posts that have an answer for this one. It appears to be a sourcing issue, but no matter what I try I can't seem to source it properly. I get the following error when trying to launch my application.
is-buffer is installed. I see it in my node-modules directory.
C:\MY-APP\dataService>node dataAPI.js
module.js:338
throw err;
^
Error: Cannot find module './is-buffer'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\MY-APP\node_modules\socket.io\node_modules\so
ket.io-adapter\node_modules\socket.io-parser\index.js:11:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I tried setting this in my binary file as well as my package.json. I'm able to change it in my binary file, but no matter what I'm not able to find the correct src dir.
I also tried npm install is-buffer -g to no avail. Any advice?
Unexpected token ILLEGAL
I was able to update the source to
var isBuf = require('C:\VF_PDO_APP\node_modules\is-buffer');
So now it seems to be going to the right place I think. Now however, I'm getting Unexpected token ILLEGAL.
C:\MY-APP\dataService>node dataAPI.js
C:\MY-APP\node_modules\socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser\binary.js:10
socket.io\node_modules\socket.io-adapter\node_modules\socket.io-parser
^^^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\MY-APP\node_modules\socket.io\node_modules\soc
ket.io-adapter\node_modules\socket.io-parser\index.js:10:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
You first must install all your project dependencies, do it on the root folder of your project:
npm install
For your problem with socket.io try to:
npm install socket.io --save
For the bson problem:
npm install bson --save
(for this one probably you will need to install python and c++)
Related
I was cleaning up the angular code and, deleted some unused custom modules. After which, It was throwing an error about a deleted imported component in app.module.ts even though it was already removed from import.
Then, I manually deleted the node modules, ran npm install and tried to run npm start which gives me the following error:
Cannot find module './framer'
Error: Cannot find module './framer'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\NBS627\eclipse-workspace\ccmobile-
UI\node_modules\spdy-transport\lib\spdy-transport\protocol\base\index.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\NBS627\eclipse-workspace\ccmobile-
UI\node_modules\spdy-transport\lib\spdy-transport.js:10:27)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
I have no idea about this error. Please help.
Your error says that you have a problem with your spdy-transport module.
To solve this you must update your spdy-transport module:
npm un spdy-transport
Then:
npm i spdy-transport
One of the packages which you deleted might have a dependency on an existing module
for example, when we do npm install package-name, often more than one folder are created in the node_modules folder, we may think that it is not required but it is in fact needed
I keep getting the same error anytime I try to use the geoproject command.
I have the latest version of node and D3 downloaded.
error message:
Parkers-MacBook-Pro-2:proj parkerbarton$ geoproject
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'resolve'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/d3-geo-projection/bin/resolve.js:2:15)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
tldr; Just re-install to get the new version of d3-geo-projection.
npm install -g d3-geo-projection
There's an issue for this here: https://github.com/d3/d3-geo-projection/issues/161
And there's a fix for this up on a pull request, but it hasn't gotten pulled in yet. You could wait for the fix or in the meantime you can probably just add 'require' into the same place in {global-install-location}/node_modules/d3-geo-projection/package.json
https://github.com/d3/d3-geo-projection/pull/162/commits/43105df62b784f0645cb3d4cb0b0fa98c8924c87
UPDATE: It's up on 2.6, just re-install d3-geo-projection.
I have problem with log4js.
Problem is that when i ran node.sj error pops up:
Error: Cannot find module 'log4js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/bot/site.js:2:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
So i instaled log4js with:
npm install log4js
And now the real error is here:
/home/bot/node_modules/log4js/lib/log4js.js:25
const debug = require('debug')('log4js:main');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/bot/site.js:2:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Maybe i have broken bot. But bot should be OK.
I had this error in past but i fixed it and do not know how. (about 2years ago?) and error was in bot folder i think.
i have Debian 7 installed on server
Thx for response.
which version of node.js are you running?
node --version
First of all try to install your application packages with npm install log4j --save (to save it in your package.json).
It seems that you are using an old version of node.js!
Using this site you can see when the keyword const was introduced without requiring the strict keyword!
http://node.green/#ES2015-bindings-const
To fix the error just need to update your node.js to the latest stable version.
Another solutions: (The previous one is my favourite).
You can set a single specific file to be strict by writing 'use strict' on top of your file.
Or you can force to run your whole application to strict by using node --use_strict index.js (I wont recommend this one)
I made this app 1-2 years ago, and I was new to node so I didn't make a proper package.json file when it was created. for some reason, it's not running any more. here is the error when i try to run server.js.
elliott:nodejs_websocket_osc mrtunes$ node server.js
info - socket.io started
/Users/mrtunes/Documents/webmusic/nodejs_websocket_osc/node_modules/node-osc/node_modules/osc-min/node_modules/binpack/node_modules/bindings/bindings.js:83
throw e
^
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/Users/mrtunes/Documents/webmusic/nodejs_websocket_osc/node_modules/node-osc/node_modules/osc-min/node_modules/binpack/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/Users/mrtunes/Documents/webmusic/nodejs_websocket_osc/node_modules/node-osc/node_modules/osc-min/node_modules/binpack/index.js:1:99)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
it looks like the bindings module is from the osc-min folder. i tried to go in there and run an npm install but no luck. i put everything on the github
I am attempting to run the demo for the mobwrite node.js package. First I installed the mobwrite package (npm install mobwrite) and then entered the following command:
node -e "require('mobwrite').quickserve()"
A demo server should start, but the following error is thrown:
module.js:340
throw err;
^
Error: Cannot find module './lib/middleware'
at Function.Module._resolveFilename (module.js:388:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (PATH_TO_MODULES\mobwrite.js:2:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at [eval]:1:1
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compie (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
This originates from the mobwrite.js file, in which the package needs to include a middleware file (middleware.coffee) which is stored in a lib folder:
require("coffee-script")
middleware = require("./lib/middleware")
module.exports = middleware
I have looked at the answers to similar posts on SO, but nothing has solved my problem so far. How can I overcome this error?
You could try manually compiling the coffeescript files to javascript: npm install -g coffee-script && coffee -c node_modules/mobwrite/lib/middleware.coffee && coffee -c node_modules/mobwrite/lib/daemon.coffee. Then retry your command.