Aurelia bundle: error loading "aurelia-cli" - jspm

When I run aurelia's bundler I get the following error:
D:\Code\Test>aurelia bundle
info: Using Aureliafile: D:\Code\Test\aureliafile.js
info: Creating bundle ...
Potentially unhandled rejection [6] Error: Error loading "aurelia-cli" at file:D:/Code/Test/aurelia-cli.js
Error loading "aurelia-cli" from "aureliafile" at file:D:/Code/Test/aureliafile.js
ENOENT, open 'D:\Code\Test\aurelia-cli.js'
at Error (native)

The problem is a combination of having set "*" : "*.js" in System.Config and using the "*" wildcard telling aurelia bundle to pull in everything. This turns out to try to include the project root files. You can either be more specific to the bundler:
aureliafile.js:
"dist/app-bundle": {
modules: [
'dist/*',
...
or reapply the jspm mapping "*" : "dist/*.js". Unfortunatly what I need is actually one configuration during development (bundling) and another during production (serving).
related issues:
https://github.com/aurelia/cli/issues/112
https://github.com/aurelia/cli/issues/116

Related

How to solve Module not found: Error: Can't resolve 'fs' without overriding webpack config

I have a react app and all of a sudden I got the below errors while I run npm start:
ERROR in ./node_modules/sass/sass.dart.js 118:12-25
Module not found: Error: Can't resolve 'fs' in .......
webpack compiled with 1 error and 1 warning
I manage to handle it with adding fallback to webpack.config.js like below:
.....
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253
fallback:{
"fs":false
},
}
it solved the problem but I don't want to override webpack.config.js because if I remove my node modules and some one else tries to npm install then he will get the error again.
how can I solve the error without overriding webpack.config.js?

When i create an angular project, it is not getting built successfully?

I reinstalled windows recently and have been facing this issue with angular since then.
My old projects are running fine, but when I create new project I am getting the following error.
I have tried to install angular CLI and Node.js again, I also reinstalled VS code.
I have tried adding the paths in the tsconfig.app.json file.
At this point, I am totally clueless.
PS D:\C#LTI\WebApi\new_project_angular> ng build
✔ Browser application bundle generation complete.
Warning: ▲ [WARNING] Comments in CSS use "/* ... */" instead of "//"
D:/C#LTI/WebApi/new_project_angular/src/app/app.component.css:1:18:
1 │ /******/ (() => { // webpackBootstrap
╵ ~~
Warning: ▲ [WARNING] Unexpected "("
D:/C#LTI/WebApi/new_project_angular/src/app/app.component.css:1:9:
1 │ /******/ (() => { // webpackBootstrap
╵ ^
../../../C#LTI/WebApi/new_project_angular/src/environments/environment.ts - Error: Module build failed (from ./node_modules/#ngtools/webpack/src/ivy/index.js):
Error: D:\C#LTI\WebApi\new_project_angular\src\environments\environment.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at D:\C#LTI\WebApi\new_project_angular\node_modules#ngtools\webpack\src\ivy\loader.js:64:26
Error: Module not found: Error: Can't resolve 'D:/C#LTI/WebApi/new_project_angular/src/app/app.component.css?ngResource' in 'D:\C#LTI\WebApi\new_project_angular'
Error: The loader "D:/C#LTI/WebApi/new_project_angular/src/app/app.component.css" didn't return a string.

NuxtJS build breaks with UglifyJS and node-rsa. How do I resolve this?

I'm using the library node-rsa (https://www.npmjs.com/package/node-rsa) in a NuxtJS project. When building for production using the command nuxt build (which includes minification of JS and CSS by default), the build process breaks near the end with the following message:
ERROR in 0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js from UglifyJs
Unexpected token: name (pem) [./~/node-rsa/src/formats/pkcs1.js:55,0][0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js:42640,20]
Error: Webpack build exited with errors
at /home/ubuntu/front-end/node_modules/nuxt/dist/nuxt.js:904:44
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:267:15
at Compiler.emitRecords (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:362:37)
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:260:12
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:355:11
at next (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/home/ubuntu/front-end/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:352:8)
at Compiler.<anonymous> (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:347:14)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:460:16
at iteratorCallback (/home/ubuntu/front-end/node_modules/async/dist/async.js:1034:13)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:944:16
at /home/ubuntu/front-end/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:117:15)
I was able to temporarily mitigate the issue by disabling uglifyJS (solution found at https://github.com/nuxt/nuxt.js/issues/250) but that does not seem like a long term solution. What is the correct way to resolve this?
Potentially related issue: Webpack breaks when i include node-rsa library
The problem is that I was trying to use a node library (not uglify-safe) on the browser without webpacking it. I switched to using pure JS for my crypto needs and everything went fine.

Webpack Error: Cannot find module "."

I am using the api from musixmatch-sdk and have an error by building my project with webpack.
I am using webpack 2, react, node.
The default import on the musixmatch site is:
var MusixmatchApi = require('../../build/javascript-client/src/index');
But this does't work and getting this error:
ERROR in ./build/javascript-client/src/index.js<br/>
Module not found: Error: Can't resolve 'ApiClient' in '/Users/myname/lyrix/build/javascript-client/src'<br/>
# ./build/javascript-client/src/index.js 28:4-2099<br/>
# ./src/server.js
So I have wrote it with an absolute path like:
const MusixmatchApi = require(path.join(__dirname,'../build/javascript-client/src/index'));
This works in development mode of webpack, but i get this warning:
WARNING in ./src/server.js
33:20-102 Critical dependency: the request of a dependency is an expression
# ./src/server.js
So if I want to build the production project i get the error:
Error: Cannot find module "."<br/>
at /Users/myname/lyrix/src/server-es5.js:1:16712<br/>
at Object.<anonymous> (/Users/myname/lyrix/src/server-es5.js:1:16782)
Can you please help me?

Unable to run grunt-karma

I am trying to use grunt-karma (https://www.npmjs.org/package/grunt-karma) with this config:
karma:
unit:
runnerPort: 9999
singleRun: true
browsers: ['PhantomJS']
logLevel: 'ERROR'
background: true
files: [JASMINE, JASMINE_ADAPTER, 'test/server/*.js']
The gruntfile is written in coffeescript. Here is the error I'm getting:
>grunt karma:unit
Loading "Gruntfile.coffee" tasks...ERROR
>> ReferenceError: JASMINE is not defined
Warning: Task "karma:unit" not found. Use --force to continue.
Aborted due to warnings.
The configuration sample (on the npm page linked to above)does not show any requirements to define JASMINE, so I'm confused what it is that I am not doing right.
Please help me fix this.
(Additionally, can you advise me of alternative ways to test nodejs + expressjs projects using grunt and jasmine)

Resources