angular-cli is reporting "Can't resolve" errors when building Angular application which uses solid-client.
One of the errors is pointing to this repository and second one points to a XMLHttpRequest - dependency used by rdflib.
Error message
ERROR in ./~/solid-client/lib/meta.js
Module not found: Error: Can't resolve '../package' in '/data2/space/angular-testing/angular-solid-client/node_modules/solid-client/lib' @ ./~/solid-client/lib/meta.js 7:10-31 @ ./~/solid-client/lib/index.js @ ./src/app/app.component.ts @ ./src/app/app.module.ts @ ./src/main.ts @ multi ./src/main.tsERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.jsModule not found: Error: Can't resolve 'child_process'in'/data2/space/angular-testing/angular-solid-client/node_modules/xmlhttprequest/lib'
@ ./~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36
@ ./~/rdflib/lib/util.js
@ ./~/rdflib/lib/index.js
@ ./~/solid-client/lib/util/rdf-parser.js
@ ./~/solid-client/lib/index.js
@ ./src/app/app.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts
Information
solid-client: 0.24.3
# ng version
@angular/cli: 1.2.1
node: 8.1.2
os: linux x64
@angular/animations: 4.3.0
@angular/common: 4.3.0
@angular/compiler: 4.3.0
@angular/core: 4.3.0
@angular/forms: 4.3.0
@angular/http: 4.3.0
@angular/platform-browser: 4.3.0
@angular/platform-browser-dynamic: 4.3.0
@angular/router: 4.3.0
@angular/cli: 1.2.1
@angular/compiler-cli: 4.3.0
@angular/language-service: 4.3.0
How to reproduce (assuming angular-cli is properly installed):
create new angular app and enter its directory
ng new angular-solid-client
cd angular-solid-client
install solid-client
npm install --save solid-client
add lib import and usage into file: src/app/app.component.ts
import{Component}from'@angular/core';import*asSolidClientfrom'solid-client';// import
@Component({selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css']})exportclassAppComponent{title='app';solid=SolidClient;// using SolidClient}run ng build
Or you can clone my seed repo in tag v0.1.0:
git clone https://github.com/tomasklapka/angular-solid-client-seed testcdtest
git checkout tags/v0.1.0
npm install
ng build
Workaround
'../package' resolve error can be fixed simply by adding ".json" extension to a filename required in node_modules/solid-client/lib/meta.js:7.
Change:
varlib=require('../package');to
varlib=require('../package.json');'child_process' error is caused by removed package replaced by empty nameholder. This module seems to be required only for synchronous calls but since it is empty it should be safe to just comment 'spawn' require in xmlhttprequest/lib/XMLHttpRequest.js:15.
Change:
varspawn=require("child_process").spawn;so it looks like this
varspawn;// = require("child_process").spawn;
angular-cli is reporting "Can't resolve" errors when building Angular application which uses solid-client.
One of the errors is pointing to this repository and second one points to a XMLHttpRequest - dependency used by rdflib.
Error message
Information
solid-client: 0.24.3
# ng version @angular/cli: 1.2.1 node: 8.1.2 os: linux x64 @angular/animations: 4.3.0 @angular/common: 4.3.0 @angular/compiler: 4.3.0 @angular/core: 4.3.0 @angular/forms: 4.3.0 @angular/http: 4.3.0 @angular/platform-browser: 4.3.0 @angular/platform-browser-dynamic: 4.3.0 @angular/router: 4.3.0 @angular/cli: 1.2.1 @angular/compiler-cli: 4.3.0 @angular/language-service: 4.3.0How to reproduce (assuming angular-cli is properly installed):
create new angular app and enter its directory
ng new angular-solid-client cd angular-solid-clientinstall solid-client
add lib import and usage into file:
src/app/app.component.tsrun
ng buildOr you can clone my seed repo in tag v0.1.0:
Workaround
'../package' resolve error can be fixed simply by adding ".json" extension to a filename required in
node_modules/solid-client/lib/meta.js:7.Change:
to
'child_process' error is caused by removed package replaced by empty nameholder. This module seems to be required only for synchronous calls but since it is empty it should be safe to just comment 'spawn' require in
xmlhttprequest/lib/XMLHttpRequest.js:15.Change:
so it looks like this