node js module libxml xsd not found - javascript

I want to install to module libxml xsd.But when i run the command npm install libxml-xsd nothing happing.When i want to test my module i try to run
var xsd = require('libxml-xsd');
but i have this error :
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'libxml-xsd'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\amine.brahmi\WebstormProjects\modeltestvalidation\test_validation.js:1:11)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
node-gyp version 3.8.0
node version 10.16.3
npm version 6.9.0
i try to install but i have the same error.
npm install libxmljs
npm install --global --production windows-build-tools
npm install libxml-xsd

node 10.X not compatible with libxml-xsd 0.5.2
you should install other version node 8.x for exemple :
then you need to install nvm to use the two node version from this link :
https://github.com/coreybutler/nvm-windows/releases
and then try nvm list to show all node versions
then install new node version with nvm 8.x 64
Next nvm use 8.x 64 to switch to use 8.x

Related

Node JS Cannot find module 'node-properties-parser' Error while running as normal user in Amazon Linux

I have installed node-properties-parser globally by running npm install -g node-properties-parser as normal user(vaisakh). Then i ran my test.js file with the command node test.js now it's throwing the error
Error: Cannot find module 'node-properties-parser'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/data02/bamboo/test.js:3:12)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
I ran the above npm install -g node-properties-parser as root user and run the node test.js here it's working fine. But why it's throwing the error while running as normal user?
Thanks. Finally i found the answer, it's working when in run sudo npm install node-properties-parser without the -g option. But still i don't know why the -g option is not woking, in the docs it's given as install globally.

"module.js:557 throw err" when running npm from terminal

when I run npm from terminal I get this error and nothing else. no npm command is working, all of them are giving the same error and I can't even install programs that are depending on nodejs.
$ npm module.js:557 throw err; ^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
This did the trick for me (I'm using OSX)
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node

Angular Cli ng serve don't work

When I try to run ng serve
I got this error :
The "#angular/compiler-cli" package was not properly installed. Error:
TypeError
: Object prototype may only be an Object or null: undefined
Error: The "#angular/compiler-cli" package was not properly installed.
Error: Ty
peError: Object prototype may only be an Object or null: undefined
at Object.<anonymous> (C:\Users\Mounadi\angular2-quickstart\node_modules\#ng
tools\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\Mounadi\angular2-quickstart\node_modules\#an
gular\cli\tasks\eject.js:10:19)
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)
I tried to uninstall #angular/cli and install #angular/cli#latest and I got the same error
Follow the below steps to start with angular CLI.
First update node version:
So, first check your node version by typing command node -v.
If node version is lower than 6.x.x then update it because angular CLI requires node version to be higher than 6.x.x. To update node version run the below command.
nvm install <new version> --reinstall-packages-from=<old version>
Ex: nvm install 7.10.0 --reinstall-packages-from=5.1.0
Then run command: nvm use 7.10.0
After this run command npm install -g #angular/cli to install Angular CLI.
Then ng new my-new-project to create new project.
Then cd my-new-project to go inside created project directory.
And then finally ng serve to run your app.
Extra:
To update your angular 2 project into angular 4 project run below command:
* On Linux/Mac: npm install #angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-
server,router,animations}#next --save server,router,animations}#next --save
* On Windows: npm install #angular/common#next #angular/compiler#next #angular/compiler-cli#next #angular/core#next
#angular/forms#next #angular/http#next #angular/platform-browser#next #angular/platform-browser-dynamic#next
#angular/platform-server#next #angular/ router#next #angular/animations#next --save

Eslint does not work on local system

I try to set up eslint for my project. When i run eslint --init the following error returns:
/usr/lib/node_modules/eslint/lib/cli.js:18
let fs = require("fs"),
^^^
SyntaxError: Unexpected strict mode reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/lib/node_modules/eslint/bin/eslint.js:29:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
I have installed eslint with sudo npm install -g eslint
So I installed node by sudo apt-get install node. This installed a version that did not support eslint. After installing NodeJS by running
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install nodejs
After upgrading from 0.12.15 to 4.4.7 eslint worked!

npm --> Err: Cannot find module 'readable-stream'

I have installed node js on my windows 10 machine, and the version is v4.4.2 but when I try to run npm install or even check npm version it throwing the following error. Any help would be greatly appreciated
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Also, after reading other solutions to this problem, npm install gulp -g, npm install 'readable-stream' or any other suggestion I read and tried did not work. It appears any command I try with npm throws the error below.
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
I have also tried uninstalling node and reinstalling and same issue persists.
I figured it out, when I uninstalld I did not delete all the files. There were the node/npm files in my C: directory and failed to realize there were a bunch of npm module files in my / directory. So after uninstalling and deleting all related files I reinstalled node/npm and it is now working.
After all the checks its clear you need to uninstall and re-install node:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable // for stable version
sudo n 0.12.7 // for specific version like v0.12.7
// check the node version after install
node -v
If you are on windows make sure after you Uninstall node you %appdata% or C:\Users\admin\AppData\Roaming and delete all the npm folders that have been created here by your previous install.
git clone https://github.com/nodejs/readable-stream into global node_modules folder

Categories