Related
I'm trying to set up a local project for decentraland on a Windows 10 machine and I'm facing some issues installing global decentraland dependencies. I found a related stackoverflow's question (npm install errors with Error: ENOENT, chmod) but it hasn't solved my issue.
I node version 17.5.0
my npm version is 8.5.1
when I try to run npm install -g decentraland I get the following output:
I get a lot of warnings and a ENOENT error due to a syscall that shouldn't exist as C:/php directory doesn't exist and php syscall isnt related to decentraland node's dependencies installation.
This is my package.json:
"name": "decentraland",
"version": "3.9.0",
"description": "Decentraland CLI developer tool.",
"bin": {
"dcl": "dist/index.js"
},
"files": [
"bin",
"dist",
"samples",
"abi"
],
"scripts": {
"start": "npm run watch",
"watch": "tsc -p tsconfig.json -w",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint --fix . --ext .ts",
"test": "FORCE_COLOR=1 ava",
"test:dry": "FORCE_COLOR=1 ava --update-snapshots",
"test:ci": "FORCE_COLOR=1 ava -v --fail-fast --match='!*E2E*' --match='!*Decentraland.deploy()*'",
"test:win": "set FORCE_COLOR=1 ava -v --fail-fast --match=\"!*E2E*\" --match=\"!*Decentraland.deploy()*\""
},
"repository": "decentraland/cli",
"keywords": [
"decentraland",
"cli",
"dcl",
"mana",
"land"
],
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"license": "Apache-2.0",
"homepage": "https://github.com/decentraland/cli",
"devDependencies": {
"#dcl/eslint-config": "^1.0.1-20211125144552.commit-722b3e8",
"#types/analytics-node": "0.0.32",
"#types/archiver": "^3.0.0",
"#types/chalk": "^2.2.0",
"#types/cors": "^2.8.12",
"#types/cross-spawn": "^6.0.2",
"#types/express": "^4.11.1",
"#types/fs-extra": "^5.0.0",
"#types/glob": "^7.1.1",
"#types/inquirer": "0.0.36",
"#types/isomorphic-fetch": "0.0.34",
"#types/node": "^12.12.55",
"#types/puppeteer": "^1.11.2",
"#types/request": "^2.48.1",
"#types/rimraf": "^3.0.2",
"#types/semver": "^7.3.9",
"#types/sinon": "^5.0.5",
"#types/uuid": "^8.3.3",
"#types/ws": "^6.0.1",
"ava": "^1.2.1",
"cross-spawn": "^6.0.5",
"husky": "^7.0.4",
"puppeteer": "^1.17.0",
"rimraf": "^2.6.2",
"sinon": "^7.1.1",
"ts-node": "^4.1.0"
},
"dependencies": {
"#dcl/linker-dapp": "^0.1.3",
"#dcl/schemas": "^3.4.1",
"analytics-node": "^3.2.0",
"archiver": "^3.1.1",
"arg": "^4.1.0",
"chalk": "^2.3.1",
"chokidar": "^2.0.3",
"cors": "^2.8.4",
"dcl-catalyst-client": "^11.0.0",
"dcl-catalyst-commons": "^8.0.0",
"dcl-node-runtime": "^1.0.0",
"docker-names": "^1.0.3",
"eth-connect": "^0.3.0",
"ethers": "^4.0.38",
"express": "^4.16.2",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"global": "^4.4.0",
"google-protobuf": "^3.8.0",
"ignore": "^4.0.6",
"inquirer": "^6.2.0",
"isomorphic-fetch": "^2.2.1",
"opn": "^5.2.0",
"ora": "^3.0.0",
"package-json": "^7.0.0",
"portfinder": "^1.0.13",
"request": "^2.88.0",
"semver": "^5.5.0",
"typescript": "^4.4.3",
"uuid": "^3.4.0",
"wildcards": "^1.0.2",
"ws": "^6.0.0"
},
"commit": "d10dbf453d860dbc5062db3114cae791eb09e21a"
What I tried:
-npm cache clean && npm cache verify
I tried "rm package-lock.json" but there's no package-lock.json on my global node directory
Reinstall npm
update node.js
I tried updating some of the packages that node.js says are deprecated.
npm install -g npm-check-updates + npm update + npm install
Here you can see /npm/node_modules/decentraland/node_modules/eccrypto/package.json:
"name": "eccrypto",
"version": "1.1.6",
"description": "JavaScript Elliptic curve cryptography library",
"main": "index.js",
"browser": "browser.js",
"scripts": {
"install": "node-gyp rebuild || exit 0",
"test": "ECCRYPTO_NO_FALLBACK=1 mocha && xvfb-run -a karma start && jshint .",
"m": "mocha",
"k": "xvfb-run -a karma start",
"kc": "xvfb-run -a karma start --browsers Chromium",
"kf": "xvfb-run -a karma start --browsers Firefox",
"j": "jshint ."
},
"repository": {
"type": "git",
"url": "https://github.com/bitchan/eccrypto.git"
},
"keywords": [
"ecc",
"ecdsa",
"ecdh",
"ecies",
"crypto",
"cryptography",
"secp256k1",
"K-256",
"elliptic",
"curve"
],
"author": "Kagami Hiiragi",
"license": "CC0-1.0",
"bugs": {
"url": "https://github.com/bitchan/eccrypto/issues"
},
"homepage": "https://github.com/bitchan/eccrypto",
"devDependencies": {
"browserify": "16.5.0",
"buffer-equal": "1.0.0",
"chai": "*",
"jshint": "*",
"karma": "4.3.0",
"karma-browserify": "6.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-firefox-launcher": "1.2.0",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.5",
"mocha": "*"
},
"dependencies": {
"acorn": "7.1.1",
"elliptic": "6.5.4",
"es6-promise": "4.2.8",
"nan": "2.14.0"
},
"optionalDependencies": {
"secp256k1": "3.7.1"
}
Finally here is the final part of the log file content npm is referring to (C:\Users\alons\AppData\Local\npm-cache_logs\2022-02-20T11_30_21_888Z-debug-0.log):
node_modules/decentraland/node_modules/eccrypto/node_modules/secp256k1 npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
3233 info run secp256k1#3.8.0 install node_modules/decentraland/node_modules/hdkey/node_modules/secp256k1 npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
3234 info run eccrypto#1.1.6 install { code: 'ENOENT', signal: undefined }
3235 info run keccak#3.0.2 install { code: 'ENOENT', signal: undefined }
3236 info run secp256k1#4.0.2 install { code: 'ENOENT', signal: undefined }
3237 info run secp256k1#3.7.1 install { code: 'ENOENT', signal: undefined }
3238 info run secp256k1#3.8.0 install { code: 'ENOENT', signal: undefined }
3239 verbose reify failed optional dependency C:\Users\alons\AppData\Roaming\npm\node_modules\decentraland\node_modules\eccrypto\node_modules\secp256k1
3240 silly reify mark deleted [
3240 silly reify 'C:\\Users\\alons\\AppData\\Roaming\\npm\\node_modules\\decentraland\\node_modules\\eccrypto\\node_modules\\secp256k1'
3240 silly reify ]
3241 timing build:run:install:node_modules/decentraland/node_modules/eccrypto/node_modules/secp256k1 Completed in 9ms
3242 timing reify:rollback:createSparse Completed in 2333ms
3243 timing reify:rollback:retireShallow Completed in 4ms
3244 timing command:install Completed in 13078ms
3245 verbose stack Error: spawn C:\php ENOENT
3245 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
3245 verbose stack at onErrorNT (node:internal/child_process:476:16)
3245 verbose stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
3246 verbose pkgid eccrypto#1.1.6
3247 verbose cwd C:\
3248 verbose Windows_NT 10.0.19044
3249 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\alons\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "decentraland"
3250 verbose node v17.5.0
3251 verbose npm v8.5.1
3252 error code ENOENT
3253 error syscall spawn C:\php
3254 error path C:\Users\alons\AppData\Roaming\npm\node_modules\decentraland\node_modules\eccrypto
3255 error errno -4058
3256 error enoent spawn C:\php ENOENT
3257 error enoent This is related to npm not being able to find a file.
3257 error enoent
3258 verbose exit -4058
3259 timing npm Completed in 13401ms
3260 verbose unfinished npm timer reify 1645358538302
3261 verbose unfinished npm timer reify:build 1645358548960
3262 verbose unfinished npm timer build 1645358548962
3263 verbose unfinished npm timer build:deps 1645358548962
3264 verbose unfinished npm timer build:run:install 1645358549017
3265 verbose unfinished npm timer build:run:install:node_modules/decentraland/node_modules/eccrypto 1645358549018
3266 verbose unfinished npm timer build:run:install:node_modules/decentraland/node_modules/keccak 1645358549025
3267 verbose unfinished npm timer build:run:install:node_modules/decentraland/node_modules/secp256k1 1645358549028
3268 verbose unfinished npm timer build:run:install:node_modules/decentraland/node_modules/hdkey/node_modules/secp256k1 1645358549034
3269 verbose code -4058
3270 error A complete log of this run can be found in:
3270 error C:\Users\alons\AppData\Local\npm-cache\_logs\2022-02-20T12_02_17_980Z-debug-0.log
I am trying to deploy my Angular Universal using Node.js option in CPanel. My configuration is as follows:
Node.js Version: 12.9.0
Application Mode: Development
Application Root: public_html/ssr
Application URL: ssr
Application Startup File: main.js
It has managed to run npm install and node_modules are now installed. But when I press 'RUN JS SCRIPT' it gives me an error. Following is the log file
0 info it worked if it ends with ok
1 verbose cli [ '/opt/alt/alt-nodejs11/root/usr/bin/node',
1 verbose cli '/opt/alt/alt-nodejs11/root/usr/bin/npm',
1 verbose cli 'run-script',
1 verbose cli 'build',
1 verbose cli '--' ]
2 info using npm#6.7.0
3 info using node#v11.15.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle sunnyssr#0.0.0~prebuild: sunnyssr#0.0.0
6 info lifecycle sunnyssr#0.0.0~build: sunnyssr#0.0.0
7 warn lifecycle The node binary used for scripts is /home/sunnytex/nodevenv/public_html/ssr/11/bin/node but npm is using /opt/alt/alt-nodejs11/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
8 verbose lifecycle sunnyssr#0.0.0~build: unsafe-perm in lifecycle true
9 verbose lifecycle sunnyssr#0.0.0~build: PATH: /opt/alt/alt-nodejs11/root/usr/lib/node_modules/npm/node_modules.bundled/npm-lifecycle/node-gyp-bin:/home/sunnytex/public_html/ssr/node_modules/.bin:/home/sunnytex/nodevenv/public_html/ssr/11/bin:/opt/alt/alt-nodejs11/root/usr/bin:/home/sunnytex/nodevenv/public_html/ssr/11/lib/bin/:/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
10 verbose lifecycle sunnyssr#0.0.0~build: CWD: /home/sunnytex/public_html/ssr
11 silly lifecycle sunnyssr#0.0.0~build: Args: [ '-c', 'ng build' ]
12 info lifecycle sunnyssr#0.0.0~build: Failed to exec build script
13 verbose stack Error: sunnyssr#0.0.0 build: `ng build`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/opt/alt/alt-nodejs11/root/usr/lib/node_modules/npm/node_modules.bundled/npm-lifecycle/lib/spawn.js:48:18)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid sunnyssr#0.0.0
15 verbose cwd /home/sunnytex/public_html/ssr
16 verbose Linux 2.6.32-954.3.5.lve1.4.76.el6.x86_64
17 verbose argv "/opt/alt/alt-nodejs11/root/usr/bin/node" "/opt/alt/alt-nodejs11/root/usr/bin/npm" "run-script" "build" "--"
18 verbose node v11.15.0
19 verbose npm v6.7.0
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error sunnyssr#0.0.0 build: `ng build`
24 error spawn ENOENT
25 error Failed at the sunnyssr#0.0.0 build script.
25 error This is probably not a problem with npm. There is likely additional logging output above.
26 verbose exit [ 1, true ]
My package.json is as follows
{
"name": "sunnyssr",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"dev:ssr": "ng run sunnyssr:serve-ssr",
"serve:ssr": "node dist/sunnyssr/server/main.js",
"build:ssr": "ng build --prod && ng run sunnyssr:server:production",
"prerender": "ng run sunnyssr:prerender"
},
"private": true,
"dependencies": {
"#angular/animations": "~10.0.4",
"#angular/common": "~10.0.4",
"#angular/compiler": "~10.0.4",
"#angular/core": "~10.0.4",
"#angular/forms": "~10.0.4",
"#angular/localize": "^10.0.4",
"#angular/platform-browser": "~10.0.4",
"#angular/platform-browser-dynamic": "~10.0.4",
"#angular/platform-server": "~10.0.4",
"#angular/router": "~10.0.4",
"#ng-bootstrap/ng-bootstrap": "^7.0.0",
"#nguniversal/express-engine": "^10.0.1",
"animate.css": "^4.1.0",
"bootstrap": "^4.5.0",
"express": "^4.15.2",
"ngx-image-zoom": "^0.6.0",
"ngx-infinite-scroll": "^9.0.0",
"ngx-owl-carousel-o": "^3.0.1",
"ngx-page-scroll": "^7.0.1",
"ngx-page-scroll-core": "^7.0.1",
"node": "^10.21.0",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.1000.3",
"#angular/cli": "^10.0.3",
"#angular/compiler-cli": "~10.0.4",
"#nguniversal/builders": "^10.0.1",
"#types/express": "^4.17.0",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
}
}
I would be grateful if someone could kindly guide me how to fix this issue. Thank in advance.
My app was working fine but suddenly started getting these errors for angular after I installed some modules for express server. After installation of those modules like
"bcryptjs": "*",
"connect-flash": "*",
"cookie-parser": "^1.4.3",
"express-messages": "*",
"express-session": "*",
"express-validator": "*",
"passport": "*",
"passport-http": "*",
"passport-local": "*"
express server is running fine but why I am getting these errors in Angular when I have not added or modified any package. I don't think they are related then why suddenly I started getting these errors:
> tsc -p src/
../node_modules/#types/bluebird/index.d.ts(50,17): error TS1005: ',' expected.
../node_modules/#types/bluebird/index.d.ts(50,31): error TS1005: ',' expected.
../node_modules/#types/bluebird/index.d.ts(1079,59): error TS1005: ']' expected.
../node_modules/#types/bluebird/index.d.ts(1079,60): error TS1005: ';' expected.
../node_modules/#types/bluebird/index.d.ts(1079,61): error TS1128: Declaration or statement expected
.
../node_modules/#types/bluebird/index.d.ts(1079,81): error TS1109: Expression expected.
../node_modules/#types/bluebird/index.d.ts(1164,1): error TS1128: Declaration or statement expected.
npm ERR! Windows_NT 6.1.7601
=============================
Command: npm -v, Results : 4.2.0
Command: node -v, Results : v7.8.0
Command: tsc -v, Results : Version 2.3.4
=============================
Following files are attached for reference:
1. Following are from npm Debug File Info generated when tried 'npm start':
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\installedSoftwares\\nodejs\\node.exe',
1 verbose cli 'D:\\installedSoftwares\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#4.2.0
3 info using node#v7.8.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle myappclient#1.0.0~prestart: myappclient#1.0.0
6 verbose lifecycle myappclient#1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle myappclient#1.0.0~prestart: PATH: D:\installedSoftwares\nodejs\node_modules\npm\bin\node-gyp-bin;D:\installedSoftwares\wamp64\www\test\work\integration7\client\node_modules\.bin;C:\Users\admin\AppData\Roaming\npm;D:\installedSoftwares\nodejs\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\installedSoftwares\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Python27;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Brackets\command;C:\Users\admin\AppData\Local\atom\bin;C:\Users\admin\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin;D:\installedSoftwares\curl;D:\installedSoftwares\Couchbase\Server\bin
8 verbose lifecycle myappclient#1.0.0~prestart: CWD: D:\installedSoftwares\wamp64\www\test\work\integration7\client
9 silly lifecycle myappclient#1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle myappclient#1.0.0~prestart: Returned: code: 2 signal: null
11 info lifecycle myappclient#1.0.0~prestart: Failed to exec prestart script
12 verbose stack Error: myappclient#1.0.0 prestart: `npm run build`
12 verbose stack Exit status 2
12 verbose stack at EventEmitter.<anonymous> (D:\installedSoftwares\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at EventEmitter.emit (events.js:194:7)
12 verbose stack at ChildProcess.<anonymous> (D:\installedSoftwares\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at ChildProcess.emit (events.js:194:7)
12 verbose stack at maybeClose (internal/child_process.js:899:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
13 verbose pkgid myappclient#1.0.0
14 verbose cwd D:\installedSoftwares\wamp64\www\test\work\integration7\client
15 error Windows_NT 6.1.7601
16 error argv "D:\\installedSoftwares\\nodejs\\node.exe" "D:\\installedSoftwares\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 error node v7.8.0
18 error npm v4.2.0
19 error code ELIFECYCLE
20 error errno 2
21 error myappclient#1.0.0 prestart: `npm run build`
21 error Exit status 2
22 error Failed at the myappclient#1.0.0 prestart script 'npm run build'.
22 error Make sure you have the latest version of node.js and npm installed.
22 error If you do, this is most likely a problem with the myappclient package,
22 error not with npm itself.
22 error Tell the author that this fails on your system:
22 error npm run build
22 error You can get information on how to open an issue for this project with:
22 error npm bugs myappclient
22 error Or if that isn't available, you can get their info via:
22 error npm owner ls myappclient
22 error There is likely additional logging output above.
23 verbose exit [ 2, true ]
2. Following snippet is for package.json_forAngular
{
"name": "myappclient",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"#angular/common": "~2.4.0",
"#angular/compiler": "~2.4.0",
"#angular/core": "~2.4.0",
"#angular/forms": "~2.4.0",
"#angular/http": "~2.4.0",
"#angular/platform-browser": "~2.4.0",
"#angular/platform-browser-dynamic": "~2.4.0",
"#angular/router": "~3.4.0",
"#ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.25",
"angular-in-memory-web-api": "~0.2.4",
"angular2-google-chart": "^2.3.0",
"core-js": "^2.4.1",
"postcss-loader": "^2.0.1",
"raw-loader": "^0.5.1",
"rxjs": "5.0.1",
"sass-loader": "^6.0.3",
"systemjs": "0.19.40",
"zone.js": "^0.7.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "*",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"#types/node": "*",
"#types/jasmine": "2.5.36"
},
"repository": {}
}
3. Following are from package.json forExpress
{
"name": "myapp",
"version": "1.0.0",
"description": "A Couchbase, Express, Angular 2, & NodeJS (CEAN) app",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"devstart": "nodemon server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "*",
"body-parser": "^1.16.1",
"connect-flash": "*",
"cookie-parser": "^1.4.3",
"couchbase": "^2.3.3",
"debug": "^2.6.6",
"ejs": "^2.5.5",
"express": "^4.14.1",
"express-messages": "*",
"express-session": "*",
"express-validator": "*",
"mongojs": "^2.4.0",
"morgan": "^1.8.1",
"nodemon": "^1.11.0",
"passport": "*",
"passport-http": "*",
"passport-local": "*",
"request": "^2.81.0",
"serve-favicon": "^2.4.2"
},
"devDependencies": {
"nodemon": "^1.11.0"
}
}
=============================================
I have already tried following:
Removed 'node_modules' folder and installed packages again using 'npm install'
Modified version of "#types/node" to latest
Modified version of "typescript" to "*", "2.3.0", "^2.3"
Thanks for your help.
After some investigation I understood that the problem occurred because I had installed some libraries for Server. After careful installation of modules, I came to know that express-validator has following dependencies:
`-- express-validator#3.2.1
+-- #types/bluebird#3.5.8
+-- #types/express#4.0.36
| +-- #types/express-serve-static-core#4.0.49
| | `-- #types/node#8.0.13
| `-- #types/serve-static#1.7.31
| `-- #types/mime#1.3.1
+-- bluebird#3.5.0
+-- lodash#4.17.4
`-- validator#6.2.1
Therefore express-validator added bluebird which was causing issue with typescript.
After my further research I understood that I need to use typescript "2.3.2". Therefore, I also modified and installed typescript version "2.3.2" for angular.
Now my problem got resolved but still I have a question.
Why client(Angular/Typescript) is causing problem for a module which is installed for Server(Express) because both of them have their own node_modules folders? How are they related? May be its a trivial question, but I lack this concept.
Thanks in advance for a detailed answer.
Today I was updating an Angular RC 6 application to the newly released final release version. Everything's working fine, however I'm having an issue with Protractor. I'm getting the following error:
server.listen(port, opt_host, function() {
TypeError: Cannot read property 'listen' of undefined
All I've changed from the previous version of the application is the package.json file. I'm guessing that this is a configuration issue but I can't seem to find anything that's changed with regards to the Protractor config.
Also I'm using webpack in this application - I don't know if it's an issue related to webpack. Maybe someone's had some issues with webpack and Angular 2 Final release version.
protractor.conf.js
'use strict';
require('ts-node/register');
require('core-js/es6');
require('reflect-metadata');
require("zone.js/dist/zone-node");
var helpers = require('./helpers');
exports.config = {
baseUrl: 'http://localhost:8080/yii/application/test_backend_mvc/branches/INT-81_RD/ng-app/dist/',
// use `npm run e2e`
specs: [
helpers.root('src/**/**.e2e.ts'),
helpers.root('src/**/*.e2e.ts')
],
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['show-fps-counter=true']
}
},
onPrepare: function() {
browser.ignoreSynchronization = true;
},
/**
* Angular 2 configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* `rootEl`
*/
useAllAngular2AppRoots: true
};
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'protractor' ]
2 info using npm#3.10.3
3 info using node#v6.5.0
4 verbose run-script [ 'preprotractor', 'protractor', 'postprotractor' ]
5 info lifecycle test-ui-prototype#1.0.0~preprotractor: test-ui-prototype#1.0.0
6 silly lifecycle test-ui-prototype#1.0.0~preprotractor: no script for preprotractor, continuing
7 info lifecycle test-ui-prototype#1.0.0~protractor: test-ui-prototype#1.0.0
8 verbose lifecycle test-ui-prototype#1.0.0~protractor: unsafe-perm in lifecycle true
9 verbose lifecycle test-ui-prototype#1.0.0~protractor: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\.bin;C:\Program Files\nodejs;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\daniel.grima\AppData\Roaming\npm
10 verbose lifecycle test-ui-prototype#1.0.0~protractor: CWD: c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
11 silly lifecycle test-ui-prototype#1.0.0~protractor: Args: [ '/d /s /c', 'protractor' ]
12 silly lifecycle test-ui-prototype#1.0.0~protractor: Returned: code: 1 signal: null
13 info lifecycle test-ui-prototype#1.0.0~protractor: Failed to exec protractor script
14 verbose stack Error: test-ui-prototype#1.0.0 protractor: `protractor`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid test-ui-prototype#1.0.0
16 verbose cwd c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
17 error Windows_NT 10.0.10586
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
19 error node v6.5.0
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error test-ui-prototype#1.0.0 protractor: `protractor`
22 error Exit status 1
23 error Failed at the test-ui-prototype#1.0.0 protractor script 'protractor'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the test-ui-prototype package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error protractor
23 error You can get information on how to open an issue for this project with:
23 error npm bugs test-ui-prototype
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls test-ui-prototype
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
package.json
{
"name": "test-ui-prototype",
"version": "1.0.0",
"scripts": {
"start": "webpack-dev-server --inline --progress --profile --bail --port 8581",
"lite": "lite-server",
"build:dev": "rimraf dist && webpack --config config/webpack.dev.js --progress --profile --bail",
"build:prod": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"test": "gulp test",
"watch": "gulp tdd",
"test:karma": "karma start",
"watch:karma": "npm run test:karma -- --auto-watch --no-single-run",
"e2e": "npm run protractor",
"e2e:live": "npm run e2e -- --elementExplorer",
"lint": "gulp tslint",
"tslint": "tslint -c tslint.json src/**/*.ts",
"protractor": "protractor",
"pree2e": "npm run webdriver:update -- --standalone",
"ci": "npm run lint && npm test && npm run e2e",
"webdriver-manager": "webdriver-manager",
"webdriver:update": "npm run webdriver-manager update",
"webdriver:start": "npm run webdriver-manager start"
},
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/router": "3.0.0",
"#angular/upgrade": "2.0.0",
"angular2-in-memory-web-api": "0.0.20",
"angular2-jwt": "^0.1.16",
"es6-shim": "^0.35.0",
"jquery": "^2.2.4",
"ng2-cookies": "^0.1.9",
"ts-node": "^0.9.3",
"primeng": "1.0.0-beta.15",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"core-js": "^2.4.0",
"zone.js": "^0.6.17"
},
"devDependencies": {
"ts-promise": "^0.3.0",
"codelyzer": "0.0.22",
"concurrently": "^2.0.0",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"gulp": "^3.9.1",
"gulp-tslint": "^5.0.0",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.22.0",
"jasmine-core": "^2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-html-reporter": "^0.2.7",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"lite-server": "^2.2.0",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.2.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"style-loader": "^0.13.1",
"ts-loader": "^0.8.1",
"tslint": "^3.10.2",
"tslint-loader": "^2.1.4",
"typescript": "^1.8.10",
"typings": "^1.3.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack-merge": "^0.14.0"
}
}
Update - Further testing
For testing purposes I've created a new project using angular-cli with Webpack. I've done this to verify whether there's anything amiss with the configurations in my application. I didn't notice anything extraordinarily different. The only thing I've tried is updating protractor to the latest version 4.0.5. Unfortunately I'm getting the same result: Cannot read property 'listen' of undefined
> test-ui-prototype#1.0.0 protractor c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app
> protractor
[16:41:24] I/direct - Using ChromeDriver directly...
[16:41:24] I/launcher - Running 1 instances of WebDriver
[16:41:24] E/launcher - Cannot read property 'listen' of undefined
[16:41:24] E/launcher - TypeError: Cannot read property 'listen' of undefined
at isFree (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:171:9)
at findPort (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:203:7)
at c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\net\portprober.js:192:5
at ManagedPromise.invokeCallback_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:2775:27)
at c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\selenium-webdriver\lib\promise.js:639:7
at ZoneDelegate.invoke (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\zone.js\dist\zone-node.js:203:28)
at Zone.run (c:\xampp\htdocs\yii\application\test_backend_mvc\branches\INT-81_RD\ng-app\node_modules\zone.js\dist\zone-node.js:96:43)
[16:41:24] E/launcher - Process exited with error code 199
When I run npm install inside my project folder, it gets terminated.
Errors show up in terminal (MacOS X):
npm ERR! install Couldn't read dependencies
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! Invalid version: "0.1.2.0"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Orion/NodeWorks/WebDev/npm-debug.log
Here i have attached the npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm#2.15.1
3 info using node#v4.4.3
4 verbose readDependencies loading dependencies from /Users/Orion/NodeWorks/WebDev/package.json
5 error install Couldn't read dependencies
6 verbose stack Error: Invalid version: "0.1.2.0"
6 verbose stack at Object.module.exports.fixVersionField (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:191:13)
6 verbose stack at /usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:32:38
6 verbose stack at Array.forEach (native)
6 verbose stack at normalize (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:31:15)
6 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:338:5)
6 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:113:5)
6 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:232:12
6 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
6 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
7 verbose cwd /Users/Orion/NodeWorks/WebDev
8 error Darwin 15.4.0
9 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
10 error node v4.4.3
11 error npm v2.15.1
12 error Invalid version: "0.1.2.0"
13 error If you need help, you may report this error at:
13 error <https://github.com/npm/npm/issues>
14 verbose exit [ 1, true ]
And here is my package.json:
{
"name": "*****",
"version": "0.1.2.0",
"private": true,
"description": "Packages for the web site ****.com",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "*****",
"license": "ISC",
"dependencies": {
"async": "^2.0.0-rc.3",
"bcryptjs": "^2.3.0",
"body-parser": "^1.15.0",
"cookie-parser": "^1.4.1",
"debug": "^2.2.0",
"del": "^2.2.0",
"elasticsearch": "^11.0.1",
"emailjs": "^1.0.4",
"express": "^4.13.4",
"express-session": "^1.13.0",
"gulp-coffee": "^2.3.2",
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^2.4.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"html-metadata": "^1.4.1",
"jade": "^1.11.0",
"knex": "^0.10.0",
"lodash": "^4.11.1",
"mongoosastic": "^4.0.2",
"mongoose": "^4.4.13",
"morgan": "^1.6.1",
"nodemailer": "^2.3.2",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"python-shell": "^0.4.0",
"q": "^1.4.1",
"request": "^2.69.0",
"serve-favicon": "^2.3.0",
"speakingurl": "^9.0.0",
"urlencode": "^1.1.0"
},
"devDependencies": {
"chai": "^3.5.0",
"grunt": "^1.0.1",
"gulp": "^3.9.1",
"gulp-jade": "^1.1.0",
"mocha": "^2.4.5"
}
}
I am using npm version 2.15.1 and node version v4.4.3.
You have an invalid version of your app.
The version should contain of 3 parts, whereas you have 4:
"version": "0.1.2.0"
Update the version to this and it should work fine:
"version": "0.1.2"
NPM is using semver which has 3 (not four) parts in the version (major, minor and patch) divided by dot sign.