How to specify that I want Node to use Windows? - node.js

I'm on a windows machine however my node is set to Darwin. Is there a command to switch ?
It's stopping me from adding a windows service and is erroring with:
Error: Cannot find module 'os-service'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Fusiozii\REST-API\rest.js:25:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Node = v6.11.2
Node-gyp = v3.4.0

Related

VSTS Angular 5 npm run failure (dep not found - dep from angular-cli)

I upgraded to angular 5 and noticed that my build keeps failing on VSTS (locally it works fine)
It looks like a dep from angular-cli cannot be found. Any solutions?
Build Output
[command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" run build -- "--env=nightlybuild""
2018-01-29T19:06:23.9805943Z
2018-01-29T19:06:23.9807508Z > aes-web-portal#0.0.0 build d:\a\1\s\AESWebPortal\aes-web-portal
2018-01-29T19:06:23.9808541Z > ng build "--env=nightlybuild"
2018-01-29T19:06:23.9809016Z
2018-01-29T19:06:26.8023599Z Cannot find module 'uglifyjs-webpack-plugin'
2018-01-29T19:06:26.8041057Z Error: Cannot find module 'uglifyjs-webpack-plugin'
2018-01-29T19:06:26.8041907Z at Function.Module._resolveFilename (module.js:469:15)
2018-01-29T19:06:26.8042680Z at Function.Module._load (module.js:417:25)
2018-01-29T19:06:26.8043360Z at Module.require (module.js:497:17)
2018-01-29T19:06:26.8044136Z at require (internal/module.js:20:19)
2018-01-29T19:06:26.8046229Z at Object.<anonymous> (d:\a\1\s\AESWebPortal\aes-web-portal\node_modules\#angular\cli\models\webpack-configs\production.js:13:24)
2018-01-29T19:06:26.8047263Z at Module._compile (module.js:570:32)
2018-01-29T19:06:26.8048144Z at Object.Module._extensions..js (module.js:579:10)
2018-01-29T19:06:26.8048743Z at Module.load (module.js:487:32)
2018-01-29T19:06:26.8049274Z at tryModuleLoad (module.js:446:12)
2018-01-29T19:06:26.8049758Z at Function.Module._load (module.js:438:3)
2018-01-29T19:06:26.8050286Z at Module.require (module.js:497:17)
2018-01-29T19:06:26.8050774Z at require (internal/module.js:20:19)
2018-01-29T19:06:26.8051383Z at Object.<anonymous> (d:\a\1\s\AESWebPortal\aes-web-portal\node_modules\#angular\cli\models\webpack-configs\index.js:9:10)
2018-01-29T19:06:26.8052009Z at Module._compile (module.js:570:32)
2018-01-29T19:06:26.8052499Z at Object.Module._extensions..js (module.js:579:10)
2018-01-29T19:06:26.8052975Z at Module.load (module.js:487:32)

ng serve: Cannot find module 'tapable'

I just transfered my Angular 5 project from one computer to another and in the new device I get the following error when trying to ng serve:
Cannot find module 'tapable'
Error: Cannot find module 'tapable'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (c:\xampp\node_modules\webpack\lib\Template.js:7:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (c:\xampp\node_modules\webpack\lib\node\NodeMainTemplatePlugin.js:5:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
I tried to:
Remove node_modules and run again npm install.
npm install tapable
My node version is 6.11.2 with npm 5.3.
Any idea what can solve it?
Fix: I had to manually npm install webpack in order to solve this issue.

Updating node.js possibly lead to npm error

I recently updated the node.js to the version 6.11.1. Got an error when accessing npm
When I tried to check the version of npm, the following error occurs
$ npm -v
module.js:471
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
After getting this error I updated the node.js to the latest version 8.1.4.
and the error is same with different line numbers.
$ npm -v
module.js:487
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
What is happening? Any fix to this issue?
At last, I got the solution.
I have copied all contents from
C:\Program Files\nodejs\node_modules\npm
and pasted it in
C:\Users\dino\AppData\Roaming\npm\node_modules\npm

Error in ng serve after installing npm angular/cli

I am a beginner in learning nodejs and angular. I have installed node and created a node project which was working fine. Then I did "npm install -g angular-cli" and after that i did ng new client and inside client when i do "ng serve" i am getting the following error:
The "#angular/compiler-cli" package was not properly installed.
Error: The "#angular/compiler-cli" package was not properly installed.
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\node_modules\#ngtools\webpack\src\index.js:14:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-configs\typescript.js:3:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-configs\index.js:9:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-config.js:4:25)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\tasks\serve.js:11:24)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\commands\serve.run.js:6:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Class.run (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\commands\serve.js:67:16)
at Class.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\ember-cli\lib\models\command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
You may have older versions.
See the instructions here and see if that helps: https://github.com/angular/angular-cli/wiki/stories-1.0-update
The steps are basically:
Uninstall old version
Update node/npm if necessary
Install new version
The link provides specifics for each of these steps along with appropriate commands.
Run these two commands:
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
Here is a simple solution to that and it works like charm.
cd into your project directory cd client.
Run npm install or yarn install, wait for it to successfully execute
Run your ng serve.
I hope this helps and much more easier
Try to run this : npm install --save-dev #angular/cli#latest

What is ngc module codegen

I am having the error
$ node node_modules/.bin/ngc --project foo
module.js:471
throw err;
^
Error: Cannot find module './codegen'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/paul/lucid/main2/cake/node_modules/.bin/ngc:5:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I'm trying to decrypt this error. What is ./codegen and what path is node trying to read it from?

Resources