How to load ogr2ogr? - node.js

I installed ogr2ogr by using npm i ogr2ogr, but when I try to call ogr2ogr from TypeScript, I am getting this error. Can anyone explain how to load ogr2ogr in TypeScript?
ERROR in ./node_modules/fs-constants/browser.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\fs-constants'
ERROR in ./node_modules/graceful-fs/polyfills.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\graceful-fs'
ERROR in ./node_modules/touch/touch.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\touch'
ERROR in ./node_modules/archiver/lib/core.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\archiver\lib'
ERROR in ./node_modules/findit/index.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\findit'
ERROR in ./node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\fs.realpath'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\fs.realpath'
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\glob'
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\glob'
ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\graceful-fs'
ERROR in ./node_modules/mkpath/mkpath.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\mkpath'
ERROR in ./node_modules/ogr2ogr/modules/zip.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/modules/csv.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/modules/util.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\node_modules\rimraf'
ERROR in ./node_modules/touch/touch.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\touch'
ERROR in ./node_modules/walkdir/walkdir.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\walkdir'
ERROR in ./node_modules/ogr2ogr/modules/util.js
Module not found: Error: Can't resolve 'os' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/archiver/lib/plugins/tar.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\archiver\lib\plugins'
ERROR in ./node_modules/crc32-stream/lib/deflate-crc32-stream.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\crc32-stream\lib'
ERROR in ./node_modules/decompress-zip/lib/extractors.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\decompress-zip\lib'
Date: 2020-07-01T08:24:43.033Z - Hash: b64823683ce88d1548b1
3 unchanged chunks
chunk {main} main.js, main.js.map (main) 42.9 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.31 MB [initial] [rendered]
Time: 2627ms
: Compiled successfully.
Date: 2020-07-01T08:37:11.803Z - Hash: e40c5c3bb1b1fec5c8bd
3 unchanged chunks
chunk {main} main.js, main.js.map (main) 44 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.82 MB [initial] [rendered]
Time: 12631ms
ERROR in ./node_modules/fs-constants/browser.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\fs-constants'
ERROR in ./node_modules/graceful-fs/polyfills.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\graceful-fs'
ERROR in ./node_modules/touch/touch.js
Module not found: Error: Can't resolve 'constants' in 'D:\Project\webmaps\node_modules\touch'
ERROR in ./node_modules/archiver/lib/core.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\archiver\lib'
ERROR in ./node_modules/findit/index.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\findit'
ERROR in ./node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\fs.realpath'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\fs.realpath'
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\glob'
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\glob'
ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\graceful-fs'
ERROR in ./node_modules/mkpath/mkpath.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\mkpath'
ERROR in ./node_modules/ogr2ogr/modules/zip.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/modules/csv.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/modules/util.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/ogr2ogr/node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\ogr2ogr\node_modules\rimraf'
ERROR in ./node_modules/touch/touch.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\touch'
ERROR in ./node_modules/walkdir/walkdir.js
Module not found: Error: Can't resolve 'fs' in 'D:\Project\webmaps\node_modules\walkdir'
ERROR in ./node_modules/ogr2ogr/modules/util.js
Module not found: Error: Can't resolve 'os' in 'D:\Project\webmaps\node_modules\ogr2ogr\modules'
ERROR in ./node_modules/archiver/lib/plugins/tar.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\archiver\lib\plugins'
ERROR in ./node_modules/crc32-stream/lib/deflate-crc32-stream.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\crc32-stream\lib'
ERROR in ./node_modules/decompress-zip/lib/extractors.js
Module not found: Error: Can't resolve 'zlib' in 'D:\Project\webmaps\node_modules\decompress-zip\lib'

Related

Config package in Vue 3 nodejs project

I'm building a project using Vue 3 and nodejs. I need to include some configurations that should change depending on where I run the code. I found the config package that seems very promising, but I started to get a huge number of errors during the start of the project.
The first issue regards some missing packages.
Module not found: Error: Can't resolve 'util' ...
Module not found: Error: Can't resolve 'path' ...
Module not found: Error: Can't resolve 'fs' ...
Module not found: Error: Can't resolve 'os' ...
I solved them by adding this code in the config file:
resolve: {
fallback: {
fs: false,
os: false,
util: false,
path: false
}
}
Now the project starts, but I get these warnings:
warning in ./node_modules/config/lib/config.js
Critical dependency: the request of a dependency is an expression
warning in ./node_modules/config/parser.js
require.extensions is not supported by webpack. Use a loader instead.
When I surf to localhost:8080 I get:
Uncaught ReferenceError: process is not defined
Instead of using resolve.fallback, I also tried to install the dependencies:
npm install path fs os util
but I continue to get the error for fs:
Module not found: Error: Can't resolve 'fs' ...
Is there a way to use the config package easily along with Vue 3?

Angular - How to import googleapis library?

I'm trying to incorporate the Google Drive API into one of my projects. The Node.js quick start guide requires me to import file-reading and googleapis libraries. However, when I try to do so, I run into issues when importing it into app.module.ts or any components:
Components import code:
import { Injectable } from '#angular/core';
import {google, drive_v3} from 'googleapis'
const drive = google.drive({version: 'v3'});
#Injectable({
providedIn: 'root'
})
export class SubscriptionService {
constructor () {}
}
Error:
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'child_process' in '...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-auth-library/build/src/crypto/node/crypto.js
Module not found: Error: Can't resolve 'crypto' in '...\node_modules\google-auth-library\build\src\crypto\node'
ERROR in ./node_modules/jwa/index.js
Module not found: Error: Can't resolve 'crypto' in '...\node_modules\jwa'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'fs' in '...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-p12-pem/build/src/index.js
Module not found: Error: Can't resolve 'fs' in '...\node_modules\google-p12-pem\build\src'
ERROR in ./node_modules/googleapis-common/build/src/discovery.js
Module not found: Error: Can't resolve 'fs' in '...\node_modules\googleapis-common\build\src'
ERROR in ./node_modules/gtoken/build/src/index.js
Module not found: Error: Can't resolve 'fs' in '...\node_modules\gtoken\build\src'
ERROR in ./node_modules/agent-base/patch-core.js
Module not found: Error: Can't resolve 'https' in '...\node_modules\agent-base'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'net' in '...\node_modules\https-proxy-agent'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'os' in '...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'path' in '...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/gaxios/build/src/gaxios.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\gaxios\build\src'
ERROR in ./node_modules/google-auth-library/build/src/auth/oauth2client.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/googleapis-common/build/src/apirequest.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\googleapis-common\build\src'
ERROR in ./node_modules/jws/lib/data-stream.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\jws\lib'ERROR in ./node_modules/jws/lib/sign-stream.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\jws\lib'ERROR in ./node_modules/jws/lib/verify-stream.js
Module not found: Error: Can't resolve 'stream' in '...\node_modules\jws\lib'ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'tls' in '...\node_modules\https-proxy-agent'
How do I properly import the googleapis library in Angular? I've tried adding the following script import to index.html as lots of people online suggest, but it doesn't seem to work (see comments).
<script src="https://apis.google.com/js/api.js"></script>
I have also made sure to perform the following installs:
npm install --save #types/gapi
npm install --save #types/gapi.auth2
npm install --save #types/gapi.client.drive
googleapis (and google-auth-library) is a NodeJS library. You can't use it in front-end projects as is. There're some workarounds - see https://medium.com/angular-in-depth/google-apis-with-angular-214fadb8fbc5 (but I didn't try it personally so can't recommend).
The other lib you mentioned - https://apis.google.com/js/api.js - is the right one, it's for front-end, but it's not modularized, it's just one big script that you need to load via script tag. That's because you cannot import it via import. To make TS compiler happy (providing you already installed types #types/gapi*) add this import in a file where you accessing gapi global object:
/// <reference types="gapi.client. drive" />

Error with xlsx-style when building angular 6 app

I installed xlsx-style in my angular 6 app via yarn and I get errors when I build my app :
ERROR in ../node_modules/xlsx-style/dist/cpexcel.js
Module not found: Error: Can't resolve './cptable' in 'C:\Users\cabannesj\Documents\Virga3\virga-frontend\node_modules\xlsx-style\dist'
ERROR in ../node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\cabannesj\Documents\Virga3\virga-frontend\node_modules\xlsx-style'
ERROR in ../node_modules/xlsx-style/ods.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\cabannesj\Documents\Virga3\virga-frontend\node_modules\xlsx-style'
I added 'xlsx.core.min.js' in the script section of my angular.json file.
I don't know what is missing to get xlsx-style work with my app.

Running webpack in VSTS / TFS, cannot find webpack

In my build process in VSTS I run
npm install -g webpack then npm install webpack both with working dir set to website project dir ( the dir where project.json and other main files are located as opposed to solution dir).
Then I run where webpack in command line task
or Get-Command -CommandType Application -ErrorAction SilentlyContinue -Name webpack | Select-Object -ExpandProperty Definition | echo in powershell task
and they both only return empty string.
So obviously runnig webpack -p as the as the next command only returns 'not found' type of response.
The term 'webpack' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Here are the npm listings for the global:
2016-11-04T15:11:38.0395583Z ##[section]Starting: npm install
2016-11-04T15:11:38.6826226Z [command]C:\Program Files\nodejs\npm.cmd install -g webpack
2016-11-04T15:11:48.7566299Z C:\Users\SrvBuildAgentUser\AppData\Roaming\npm\webpack -> C:\Users\SrvBuildAgentUser\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js
2016-11-04T15:11:48.8726415Z C:\Users\SrvBuildAgentUser\AppData\Roaming\npm
2016-11-04T15:11:48.8726415Z `-- webpack#1.13.3
2016-11-04T15:11:48.8726415Z
2016-11-04T15:11:48.8736416Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents):
2016-11-04T15:11:48.8976440Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2016-11-04T15:11:48.9066449Z ##[section]Finishing: npm install
and for the one without global:
2016-11-04T15:11:48.9086451Z ##[section]Starting: npm install
2016-11-04T15:11:49.5467089Z [command]C:\Program Files\nodejs\npm.cmd install webpack
2016-11-04T15:11:56.8194361Z asp.net#1.0.0 C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite
2016-11-04T15:11:56.8204362Z +-- UNMET DEPENDENCY rxjs#5.0.0-beta.12
2016-11-04T15:11:56.8204362Z `-- webpack#1.13.3
2016-11-04T15:11:56.8204362Z
2016-11-04T15:11:56.8214363Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
2016-11-04T15:11:56.8214363Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2016-11-04T15:11:56.8224364Z npm WARN asp.net#1.0.0 requires a peer of rxjs#5.0.0-beta.12 but none was installed.
2016-11-04T15:11:56.8504392Z ##[section]Finishing: npm install
and then the webpack -p will just fail with:
2016-11-04T15:11:56.8524394Z ##[section]Starting: PowerShell Script
2016-11-04T15:11:56.9024444Z ##[command]. 'C:\Users\SrvBuildAgentUser\AppData\Local\Temp\d8093b24-25d4-4c1d-aeab-5f9f41abb954.ps1'
2016-11-04T15:11:57.9345476Z C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite
2016-11-04T15:11:58.4295971Z ##[error]webpack : The term 'webpack' is not recognized as the name of a cmdlet, functio
n, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At C:\Users\SrvBuildAgentUser\AppData\Local\Temp\d8093b24-25d4-4c1d-aeab-5f9f41
abb954.ps1:7 char:1
+ webpack -p
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (webpack:String) [], CommandNotF
oundException
+ FullyQualifiedErrorId : CommandNotFoundException
2016-11-04T15:11:58.4355977Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
2016-11-04T15:11:58.4375979Z ##[section]Finishing: PowerShell Script
So I even pushed node_modules/.bin/ to repo and I tried to run node_modules\.bin\webpack
and so it found the webpack but it messes up paths and won't find some modules:
2016-11-04T14:47:02.4346130Z ##[section]Starting: Run node_modules\.bin\webpack
2016-11-04T14:47:02.4366130Z ##[command]node_modules\.bin\webpack -p
2016-11-04T14:47:04.6596130Z Hash: 6a3774e770e7be6ac786
2016-11-04T14:47:04.6596130Z Version: webpack 1.13.3
2016-11-04T14:47:04.6596130Z Time: 925ms
2016-11-04T14:47:04.6596130Z Asset Size Chunks Chunk Names
2016-11-04T14:47:04.6596130Z vendor.bundle.js 734 bytes 0 [emitted] vendor
2016-11-04T14:47:04.6596130Z main.bundle.js 33.4 kB 1, 0 [emitted] main
2016-11-04T14:47:04.6596130Z [0] ./app/main.js 500 bytes {1} [built] [2 errors]
2016-11-04T14:47:04.6596130Z [1] ./app/Helpers.js 1.62 kB {1} [built]
2016-11-04T14:47:04.6596130Z [2] ./app/ProductAccessibilityValidator.js 2.06 kB {1} [built] [2 errors]
2016-11-04T14:47:04.6606130Z [3] ./app/UserProfileProvider.js 1.74 kB {1} [built] [3 errors]
2016-11-04T14:47:04.6606130Z [10] ./app/app.routing.js 1.93 kB {1} [built] [1 error]
2016-11-04T14:47:04.6606130Z [11] ./app/component.js 1.22 kB {1} [built] [1 error]
2016-11-04T14:47:04.6606130Z [20] ./app/module.js 4.09 kB {1} [built] [4 errors]
2016-11-04T14:47:04.6606130Z + 14 hidden modules
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z WARNING in main.bundle.js from UglifyJs
2016-11-04T14:47:04.6606130Z Side effects in initialization of unused variable SearchResult [./app/components/search-page.component.js:20,0]
2016-11-04T14:47:04.6606130Z Side effects in initialization of unused variable SearchResult [./app/components/product-search.component.js:20,0]
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/main.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/platform-browser-dynamic' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/main.js 2:33-77
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/main.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/main.js 3:13-37
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/module.js 11:13-37
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/platform-browser' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/module.js 12:25-61
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/forms' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/module.js 13:14-39
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/module.js 14:13-37
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/app.routing.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '#angular/router' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z # ./app/app.routing.js 2:15-41
2016-11-04T14:47:04.6606130Z
2016-11-04T14:47:04.6606130Z ERROR in ./app/component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '#angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z # ./app/component.js 11:13-37
2016-11-04T14:47:04.6616130Z
2016-11-04T14:47:04.6616130Z ERROR in ./app/UserProfileProvider.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '#angular/core' in C:\agent_work\10\s\mySolution.Web## Heading ##Site\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z # ./app/UserProfileProvider.js 14:13-37
2016-11-04T14:47:04.6616130Z
2016-11-04T14:47:04.6616130Z ERROR in ./app/UserProfileProvider.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '#angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z # ./app/UserProfileProvider.js 15:13-37
2016-11-04T14:47:04.6616130Z
2016-11-04T14:47:04.6616130Z ERROR in ./app/components/product-search.component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '#angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app\components
2016-11-04T14:47:04.6616130Z # ./app/components/product-search.component.js 14:13-37 15:13-37
2016-11-04T14:47:04.6616130Z
2016-11-04T14:47:04.6616130Z ERROR in ./app/components/product-search.component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '#angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app\components
2016-11-04T14:47:04.6616130Z # ./app/components/product-search.component.js 16:13-37
(and so on)
Can you help me fix this?
The problem is that the global directory of node is probably not in the PATH of the user running the VSTS agent.
You can probably target the webpack cmd helper using C:\NPM\Modules\webpack after installing it globally.
You can add Webpack integrated with VSTS from Marketplace to your VSTS. https://github.com/Dealogic/webpack-vsts-extension
Then exactly like Gulp you can run webpack files.

Install imdb-api and use it in Angular2 Webpack

I am trying to use the imdb-api repo (https://github.com/worr/node-imdb-api) in my angular2 project, but can't seem to get it working.
I'm working on the newest angular2 webpack (Angular2 Webpack Starter). I usually know how to get libs working, but this one is just not working :(
Have cloned the Angular2 Webpack starter, and made the Npm install and npm start.. everything works great.
Then I have installed version 2.0.0 of imdb-api like this:
npm install --save imdb-api
It installed with no problems.
In a component, (lets say the about component) , I have imported the module like:
import * as imdb from 'imdb-api';
In the constructor, I am trying to console.log(imdb) to see if it's available.
constructor(public route: ActivatedRoute) {
// var imdb = require('imdb-api');
console.log(imdb);
}
As you see, I also tried using the var imdb = require ...
The problem is all this gives me errors I just can't seem to solve. I am getting the following errors:
ERROR in ./~/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\request\lib'
ERROR in ./~/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\forever-agent'
ERROR in ./~/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\forever-agent'
ERROR in ./~/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\tough-cookie\lib'
ERROR in ./~/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\tunnel-agent'
ERROR in ./~/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\Users\Mikkel\Documents\Programmering\angular2-webpack-starter\node_modules\tunnel-agent'
I have found a post about the request problem. The imdb-api is using the request-promise, thats why I'm getting the error.
The post you find here: https://github.com/request/request/issues/1529
The suggested to add the following:
console: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty'
to the node object in the webpack.config.js file. Have added it to the webpack dev config, but now I don't see any errors at all, but the application wont load.

Resources