I am attempting to load breeze using browserify. I used npm to install the breeze-client library. If I run browserify without including breeze everything runs fine, but when I include breeze I get the following error:
Error: Cannot find module 'breeze' from 'C:\...\node_modules\breeze-client'
I've tried doing the require every way I can think of
require("breeze-client");
require("breeze-client/breeze.debug");
require("breeze-client/breeze.debug.js");
require("../node_modules/breeze-client");
// etc...
Only thing I can think of now is that there is an issue with the module that's causing a problem with browserify.
Does anyone know of a change that can be made to the module to get this to work or is there some setting in browserify that I need to use?
Complete error message when trying to run browserify directly on the breeze module:
C:\...>browserify "node_modules/breeze-client" -o "scripts/dist/breeze.js"
Error: Cannot find module 'breeze' from 'C:\...\node_modules\breeze-client'
at C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:46:17
at process (C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:173:43)
at ondir (C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:188:17)
at load (C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:69:43)
at onex (C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:92:31)
at C:\...\node_modules\browserify\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:95:15)
need to make sure all references to require("breeze") were updated to require("breeze-client") inside the breeze.debug.js file as well as any adapters you might include from the build/adapters directory.
There is a pull-request in to fix this so hopefully it won't be a problem in future versions.
Related
How to right add angular-file-saver in AngularJS project?
I trying to implement: angular-file-saver (FileSaver.js version for Angularjs) But it's not working.
1) installing filesaver file upload via bower with the command:
bower install angular-file-saver --save
2) I am trying to addition FileSaver.js module in app.js , but in browser console after starting have error:
window.mmvvtApp = angular.module('mmvvt', ['ngBootstrap', 'ngFileSaver',...
Failed to instantiate module mmvvt due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.2.26/$injector/modulerr?p0=...)
If i remove the 'ngFileSaver' from function then I am not facing the issue but when I put it in the function legislator and try to call it I get the issue.
May be non compatible versions: AngularJS#1.2.26 and angular-file-saver#1.1.3 don’t work together ?
Can someone help me please?
Thank you.
Earned after include in file "WEB-INF/jsp/main.jsp" next code:
<script src="bower_components/angular-file-saver/dist/angular-file-saver.bundle.js"></script>
AngularJS#1.2.26 and angular-file-saver#1.1.3 work together correctly.
Ive created a library that helps to trace an object state using rx streams and
Im trying to publish it to npm community.
you can check this out In my github repo
I want to compile my library to a single Javascript file and also create a declaration file ".d.ts" for Typescript users.
As i understand, when running $ npm publish i release my entire repository. what i want is to release the dist folder with the library source and declaration file and so the end users will be able to debug my library if necessary through their code so i need also source map.
So first i need to compile my src directory to a single javascript file and i have 2 ways to do so, using tsc or with webpack.
What ive tried so far and you should know:
I used module alias, configured in tsconfig.json.
I separated the library's bussiness logic to multiple files.
I wanted to import internal library's modules using "#lib" prefix.
so in my tsconfig.json i added:
"paths": {
"#lib/*": [
"src/*"
]
},
That alone cause some problems.
first of all running the command:
$ tsc src/index.ts
doesn't work at all and it shows me an error:
src/index.ts(3,15): error TS2307: Cannot find module '#lib/state-traceable'.
src/index.ts(4,15): error TS2307: Cannot find module '#lib/traceable-decorator'. src/index.ts(5,15): error TS2307: Cannot find module '#lib/effect-decorator'.
src/index.ts(6,15): error TS2307: Cannot find module '#lib/meta'.
yet running the command:
$ tsc
does actually works but it compiles each source file and create declaration file for each one of them.
Additionally, it preserves the path alias "#lib/*" instead of compiling it to something javscript compatible with relative paths "../", "./" etc...
Using webpack:
I succeed to bundle all my library sources to a single file and get rid of the "#lib" prefix however im not able to create a single declaration file.
im using "awesome-typescript-loader" plugin for webpack.
I created an issue, thought its a bug but i yet received any response from them:
https://github.com/s-panferov/awesome-typescript-loader/issues/559
Also tried to get some help from Gitter chats, Typescript community, "awesome-typescript-loader" library has no dedicated chat but couldn't find any useful information. Most of the examples ive seen, Typescript library publishers used to create a single file in their source directory: "index.ts" and it makes life easier because you can use tsc and compile that single file to a javascript file.
I hope i will find salvation here.
Some general info about the environment itself:
OS: Windows 10 Pro
Node Version: 9.5.0
npm version: 5.6.0
webpack version: 4.2.0
Please use the path configuration like below
"paths": {
"#lib/state-traceable": ["src/state-traceable.ts"],
"#lib/meta": ["src/meta.ts"],
"#lib/effect-decorator": ["src/effect-decorator.ts"],
"#lib/traceable-decorator": ["src/traceable-decorator.ts"],
"#lib/contracts/*": ["src/contracts/*"],
"#lib/utils/*": ["src/utils/*"],
"#lib/rx-operators/*": ["src/rx-operators/*"]
},
Forgive me if this is something simple as my research has come up empty in regards to this specific issue. I am using Bootstrap the most recent release. I have noticed that there is a file that is new from previous releases called npm.js. I am hosting all the Bootstrap files locally on my hosted web server. I call the file like all the others in the head to the full path to the file. In the console I have this error.
npm.js:2 Uncaught ReferenceError: require is not defined
at npm.js:2
Which is referring to this line.
require('../../js/transition.js')`
Which is from this npm.js file that is in the newest Bootstrap
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
I am unfamilar with this so I am not sure why I am getting this error but, how can I surpress this error and fix this issue? Do I even need this file? From what I understand if I am using modals or tooltips etc I need this. Is this correct?
You will need to download/config the missing libraries or requires. I am not sure which libraries you are using.
You can add the missing libraries to your package.json. Then call for npm install.
I'm trying to use tracking-js library in my project I'm using react but I dont know if I'm doing anything wrong but keep showing that the module is not found, I already check my package.json and the module install. So this is how I require the module:
const tracking = require("tracking");
what am I doing wrong?
For node, including node-based build tools, first make sure that the module is present. Keep in mind that require does not care about the package.json of your app, only about the module files being present.
Check if node_modules/tracking is present.
Make sure the "main" JS file can be found. If there's a node_modules/tracking/package.json file, see if it has a main property and if the file it references exists. If there is no main property, make sure there's an index.js in the root of the module directory.
If all this is fine and you're getting the module not found error at runtime in client-side JavaScript, then your bundling config may be incorrect, and your webpack/browserify/whatever config will have to be scrutinized for bugs.
I have a script requiring lwip#0.0.8 requiring as such:
require("lwip");
When I run browserify on the script, I get the following error:
Error: Cannot find module '../build/Release/lwip_encoder' from '/Users/sihrc/Documents/sample_project/node_modules/lwip/lib'
at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
at load (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
at onex (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:82:15)
I checked the in the build/Release and found that lwip_encoder.node exists but not without the extension. I tried making a copy without the extension, but it turns out it's a compiled file (I think?). Is a dependency like this not 'browserify'-able because it's compiled?
Or is there a way to do this properly?
I guess, for some libraries that have compiled C code, browserify simply won't work. It just doesn't make sense. Goes to show that I shouldn't ask questions on StackOverflow this late.