Related
Yesterday I noticed something very odd after cloning my work groups repository. After installing dependencies with npm install, I could not start the devserver (or run any npm scripts) inside the project. Strange. So I then tried to create my own fresh new project with #vue/cli and the same thing happened there.
Environment:
Node: v14.15.0
NPM: v6.14.8
Globally installed Vue Cli: v4.5.8
macOS Catalina: v10.15.7
Package.json in project:
"name": "eezer_app",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuetify": "^2.2.11",
"vuex": "^3.4.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"vue-cli-plugin-vuetify": "~2.0.7",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.3.0"
}
}
Error output:
➜ eezer_app git:(master) ✗ npm run serve
> eezer_app#0.1.0 serve /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
> vue-cli-service serve
sh: vue-cli-service: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! eezer_app#0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the eezer_app#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/my-real-name/.npm/_logs/2020-11-03T09_50_50_094Z-debug.log
Debug log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'serve' ]
2 info using npm#6.14.8
3 info using node#v14.15.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle eezer_app#0.1.0~preserve: eezer_app#0.1.0
6 info lifecycle eezer_app#0.1.0~serve: eezer_app#0.1.0
7 verbose lifecycle eezer_app#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle eezer_app#0.1.0~serve: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle eezer_app#0.1.0~serve: CWD: /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
10 silly lifecycle eezer_app#0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 info lifecycle eezer_app#0.1.0~serve: Failed to exec serve script
12 verbose stack Error: eezer_app#0.1.0 serve: `vue-cli-service serve`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1048:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid eezer_app#0.1.0
14 verbose cwd /Users/my-real-name/Documents/frontend-jensen/UX:UI-2/eezer_app
15 verbose Darwin 19.6.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
17 verbose node v14.15.0
18 verbose npm v6.14.8
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error eezer_app#0.1.0 serve: `vue-cli-service serve`
23 error spawn ENOENT
24 error Failed at the eezer_app#0.1.0 serve script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
Same error shows up in a freshly made Vue project created with vue create as well.
It seems that npm is trying to look for dependency packages globally instead of locally in node_modules, since I can run serve by manually selecting the script in local node_module .bin like this:
./node_modules/.bin/vue-cli-service serve
Then it starts perfectly without any fault, so there is no issue with installed node_modules etc. I have tried fixing this since yesterday with no results. I found tips to clear npm cache, delete local node_modules & package-lock.json but it does not work at all. I even re-installed CLT on my Mac.
What happened with my npm? Why does it seem to look for dependencies in my global node_module?
Appreciate any kind of tips since I have exhausted most of my options.
I updated Node, NPM, all my global node modules, ran brew update, reinstalled xcode: sudo rm -rf /Library/Developer/CommandLineTools then xcode-select --install and it seems to be working again.
Same error shows up in a freshly made Vue project created with vue create as well.
created a fresh vue project using #vue/cli and I was able to run npm run serve. Hopefully this helps for anyone else facing this issue.
I have a problem with running the command : npm run serve
to fix it i need to logout or reboot my Ubuntu 16.04
I have checked the running tasks and node is not running.
I have also uninstalled node and npm and installed again with NVM but i still have the problem .
Npm error log :
> customer-frontend#0.1.0 serve /home/work/work/git_repositories/xyz/ customer-frontend
> vue-cli-service serve --open
INFO Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/work/work/git_repositories/xyz/customer-frontend/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1374:19)
at Object.fs.watch (fs.js:1400:11)
at createFsWatchInstance (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s customer-frontend#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
/home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/work/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/work/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle customer-frontend#0.1.0~preserve: customer-frontend#0.1.0
6 info lifecycle customer-frontend#0.1.0~serve: customer-frontend#0.1.0
7 verbose lifecycle customer-frontend#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle customer-frontend#0.1.0~serve: PATH: /home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/work/work/git_repositories/XYZ/customer-frontend/node_modules/.bin:/home/work/.nvm/versions/node/v8.9.4/bin:/home/work/bin:/home/work/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle customer-frontend#0.1.0~serve: CWD: /home/work/work/git_repositories/XYZ/customer-frontend
10 silly lifecycle customer-frontend#0.1.0~serve: Args: [ '-c', 'vue-cli-service serve --open' ]
11 silly lifecycle customer-frontend#0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle customer-frontend#0.1.0~serve: Failed to exec serve script
13 verbose stack Error: customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid customer-frontend#0.1.0
15 verbose cwd /home/work/work/git_repositories/XYZ/customer-frontend
16 verbose Linux 4.13.0-36-generic
17 verbose argv "/home/work/.nvm/versions/node/v8.9.4/bin/node" "/home/work/.nvm/versions/node/v8.9.4/bin/npm" "run" "serve"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error customer-frontend#0.1.0 serve: `vue-cli-service serve --open`
22 error Exit status 1
23 error Failed at the customer-frontend#0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The project is based on Vuejs (typescript)
The thing is that i can run "npm run dev" without problem on other projects that are normal Vuejs (not typescript)
this is the Package.json
{
"name": "xyz-customer-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"test": "vue-cli-service test",
"e2e": "vue-cli-service e2e",
"e2e:open": "vue-cli-service e2e:open"
},
"dependencies": {
"axios": "^0.17.1",
"buefy": "^0.6.3",
"bulma": "^0.6.2",
"echarts": "^4.0.2",
"register-service-worker": "^1.0.0",
"vue": "^2.5.13",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^6.0.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-class": "^0.3.0",
"vuex-persistedstate": "^2.4.2"
},
"devDependencies": {
"#types/chai": "^4.1.0",
"#types/mocha": "^2.2.46",
"#vue/cli-plugin-babel": "^3.0.0-beta.1",
"#vue/cli-plugin-e2e-cypress": "^3.0.0-beta.1",
"#vue/cli-plugin-pwa": "^3.0.0-beta.1",
"#vue/cli-plugin-typescript": "^3.0.0-beta.1",
"#vue/cli-plugin-unit-mocha": "^3.0.0-beta.1",
"#vue/cli-service": "^3.0.0-beta.1",
"#vue/test-utils": "^1.0.0-beta.10",
"chai": "^4.1.2",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"vue-template-compiler": "^2.5.13"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Node Version : v8.9.4
Npm Version : v5.6.0
Thanks for your time .
Running this code have solved my problem on ubuntu 16.04
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Honestly, I don't know why this Error occurred!
But, once I tested it with sudo in terminal, it worked:
sudo npm run serve
or, for development:
sudo npm run dev
if you are getting problem to run command npm run serve than just delete your "node_modules" folder from your project and run command npm i or npm install which just run anyone command. This command will install your "node_modules" folder
again and with new and good dependencies now you are ready to use command
npm run serve
Thanks
Following the local development setup instructions for Angular 2 at https://angular.io/docs/ts/latest/guide/setup.html on Windows 10 works for the first run of the local development environment. Both "npm install" and "npm start" work fine. However, after closing all programs and trying again to run "npm start" there are console errors and an error log file, but the browser doesn't open.
Three times I've done a fresh install/start on Angular's quickstart files, and each time it fails to run after the initial setup as described above.
Solutions in other threads didn't work or were not applicable, but I'm including the contents of package.json since some issues previously discussed have referenced that file.
I followed the instructions in the command line outputs to report the problem to the "author" but got no response.
The "Report issues" link at https://angular.io/docs/ts/latest/guide/learning-angular.html directs people to pose questions on GitHub, but the administrators on GitHub respond to a detailed post in their particular format within 20 seconds saying to post instead on StackOverflow.
I'd appreciate help in workarounds or suggestions on how to actually report problems to the Angular folks.
Here are the 3 items that seem most relevant:
command line:
C:\Users\username\Documents\js\quickstart>npm start
> angular-quickstart#1.0.0 prestart C:\Users\username\Documents\js\quickstart
> npm run build
> angular-quickstart#1.0.0 build C:\Users\username\Documents\js\quickstart
> tsc -p src/
src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation.
src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart#1.0.0 build: `tsc -p src/`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 build script 'tsc -p src/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc -p src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\username\Documents\js\quickstart\npm-debug.log
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart#1.0.0 prestart: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart#1.0.0 prestart script 'npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\username\Documents\js\quickstart\npm-debug.log
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 'start' ]
2 info using npm#3.10.10
3 info using node#v6.9.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart#1.0.0~prestart: angular-quickstart#1.0.0
6 verbose lifecycle angular-quickstart#1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart#1.0.0~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\username\Documents\js\quickstart\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;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)\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\nodejs\;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Roaming\npm
8 verbose lifecycle angular-quickstart#1.0.0~prestart: CWD: C:\Users\username\Documents\js\quickstart
9 silly lifecycle angular-quickstart#1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle angular-quickstart#1.0.0~prestart: Returned: code: 1 signal: null
11 info lifecycle angular-quickstart#1.0.0~prestart: Failed to exec prestart script
12 verbose stack Error: angular-quickstart#1.0.0 prestart: `npm run build`
12 verbose stack Exit status 1
12 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at EventEmitter.emit (events.js:191:7)
12 verbose stack at ChildProcess.<anonymous> (C:\Program Files\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:191:7)
12 verbose stack at maybeClose (internal/child_process.js:877:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
13 verbose pkgid angular-quickstart#1.0.0
14 verbose cwd C:\Users\username\Documents\js\quickstart
15 error Windows_NT 10.0.14393
16 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 error node v6.9.5
18 error npm v3.10.10
19 error code ELIFECYCLE
20 error angular-quickstart#1.0.0 prestart: `npm run build`
20 error Exit status 1
21 error Failed at the angular-quickstart#1.0.0 prestart script 'npm run build'.
21 error Make sure you have the latest version of node.js and npm installed.
21 error If you do, this is most likely a problem with the angular-quickstart package,
21 error not with npm itself.
21 error Tell the author that this fails on your system:
21 error npm run build
21 error You can get information on how to open an issue for this project with:
21 error npm bugs angular-quickstart
21 error Or if that isn't available, you can get their info via:
21 error npm owner ls angular-quickstart
21 error There is likely additional logging output above.
22 verbose exit [ 1, true ]
package.json
{
"name": "angular-quickstart",
"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",
"angular-in-memory-web-api": "~0.2.4",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.7.4"
},
"devDependencies": {
"concurrently": "^3.1.0",
"lite-server": "^2.2.2",
"typescript": "~2.0.10",
"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": "^6.0.46",
"#types/jasmine": "^2.5.36"
},
"repository": {}
}
The more fundamental answer is to use an IDE such as https://code.visualstudio.com/ that will flag errors in the code regardless of when they occurred. The combination of VSCode with extensions such as the following prevents annoyances such as described in this thread:
TypeScript Hero
TSLint
angular2-inline
I figured this out. The error was pointed out by these lines:
src/app/hero.service.ts(22,2): error TS2393: Duplicate function implementation.
src/app/hero.service.ts(34,2): error TS2393: Duplicate function implementation.
Fixing the error in the hero.service.ts file fixed the problem. The confusing part was that the files kept working while the local development environment was running, despite having an error. The error was only evident when restarting the server.
In another demo folder there was another error, a missing comma in an #NGModule declarations array. The same issue occurred - the local development environment didn't complain while it was still open, but wouldn't restart.
This sounds like it could be a caching problem, and like caching problems it was confusing to someone unfamiliar with this environment.
Version info :
node#4.6.0
node-gyp#3.4.0
npm#2.15.9
I try to install the following dependencies :
"canvas": "^1.1.6",
"exec-sync": "^0.1.6",
"fabric": "^1.6.0",
"request": "^2.67.0",
"word": "^0.2.4"
So i do an npm install the following dependencies are installed:
"canvas": "^1.1.6",
"fabric": "^1.6.0",
"request": "^2.67.0",
"word": "^0.2.4"
But the exec-sync delivers the following error:
1443 verbose stack Error: ffi#1.2.5 install: `node-gyp rebuild`
1443 verbose stack Exit status 1
1443 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
1443 verbose stack at emitTwo (events.js:87:13)
1443 verbose stack at EventEmitter.emit (events.js:172:7)
1443 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
1443 verbose stack at emitTwo (events.js:87:13)
1443 verbose stack at ChildProcess.emit (events.js:172:7)
1443 verbose stack at maybeClose (internal/child_process.js:829:16)
1443 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Im a litte bit lost at this point, i tried the following things:
Deleted all the node_modules and tried an fresh install;
Tried installing the modules seperately;
Is it a version problem of node.js vs the exec-sync build?, im lost.
I fixed it!
CD to node_modules
git clone https://github.com/jeremyfa/node-exec-sync edit
open node-exec-sync/package.json to remove the ffi dependency line
npm install ./node-exec-sync
Here are the steps I followed as a workaround to npm install for testing:
removed exec-sync dependency from package.json
npm install ffi (installs latest version ok)
git clone https://github.com/jeremyfa/node-exec-sync
edit node-exec-sync/package.json to remove the ffi dependency line
npm install ./node-exec-sync then npm install finished ok
Don't use node-exec-sync, it's very difficult to install, on every OS that I've tried, for different reasons.
Instead, use https://www.npmjs.com/package/cross-spawn , which doesn't have any of these unbuildable native dependencies. It's basically an all-around better replacement for node-exec-sync or the built-in child_process APIs.
I'm facing a similar issue found in this question: Win 8.1, Vagrant, Chef, Ubuntu, Ember-cli, ember new "npm ERR! tar.unpack untar error /home/vagrant/.npm/"
I'm trying to update an older ember project to 2.1 using the new ember-cli.
I'm running my project on a vagrant server.
I have node (v.0.12.7), npm (3.3.10), bower (1.6.5)
and ember-cli -g (version: 1.13.8, node: 0.12.7, npm: 2.13.4, os: linux x64) installed.
Yet, whenever I'm running "npm install --no-bin-links" on the project generated by ember init I get the following error:
51716 error tar.unpack untar error /home/vagrant/.npm/ember-cli/1.13.8/package.tgz
51717 verbose stack RangeError: Maximum call stack size exceeded
51717 verbose stack at Array.filter (native)
51717 verbose stack at /usr/lib/node_modules/npm/lib/install/actions.js:55:37
51717 verbose stack at Array.forEach (native)
51717 verbose stack at markAsFailed (/usr/lib/node_modules/npm/lib/install/actions.js:54:16)
51717 verbose stack at /usr/lib/node_modules/npm/lib/install/actions.js:57:7
51717 verbose stack at Array.forEach (native)
51717 verbose stack at markAsFailed (/usr/lib/node_modules/npm/lib/install/actions.js:54:16)
51717 verbose stack at /usr/lib/node_modules/npm/lib/install/actions.js:57:7
51717 verbose stack at Array.forEach (native)
51717 verbose stack at markAsFailed (/usr/lib/node_modules/npm/lib/install/actions.js:54:16)
51718 verbose cwd /at/Site/public/preview/EP
51719 error Linux 3.2.0-4-amd64
51720 error argv "node" "/usr/bin/npm" "i"
51721 error node v0.12.7
51722 error npm v3.3.10
51723 error Maximum call stack size exceeded
51724 error If you need help, you may report this error at:
51724 error <https://github.com/npm/npm/issues>
51725 verbose exit [ 1, true ]
Is this related to the different version numbers of npm (globally and in ember-cli) or is this something in my vagrant setup? This problem isn't caused by the windows max path length, I've already checked.
EDIT
I've tried to install the npm packages separately instead of with "npm install --no-bin-links". The only one failing is "npm install --no-bin-links ember-cli#1.13.8". These are the dependencies within my package.json:
"broccoli-asset-rev": "^2.1.2",
"ember-cli": "1.13.8",
"ember-cli-app-version": "0.5.0",
"ember-cli-babel": "^5.1.3",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.0.1",
"ember-cli-htmlbars": "0.7.9",
"ember-cli-htmlbars-inline-precompile": "^0.2.0",
"ember-cli-ic-ajax": "0.2.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.0",
"ember-cli-release": "0.2.3",
"ember-cli-sri": "^1.0.3",
"ember-cli-uglify": "^1.2.0",
"ember-data": "1.13.8",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3"
Thank you for your time
I've fixed my problem.
As it turns out, the way My folder was mounted in my vagrant was so slow it interfered with my npm install.
In my vagrant file the folder was mounted like so:
config.vm.synced_folder "../", "/at"
I've replaced it with this:
config.vm.provision "shell", run: "always" do |s|
s.inline = "sudo apt-get update
sudo bash /vagrant/mountfolder.sh"
end
And next to my vagrant file I've placed a file "mountfolder.sh"
# replace your username and password with for example: user, ****. Replace YOURSHARENAME with the name of your windows share
# mountpoint checks if share is already mounted, prevents warning when provisioning
mountpoint -q /projects|| (mkdir /projects -p && apt-get -y install cifs-utils && mount -t cifs //192.168.255.1/YOURSHARENAME /projects --verbose -o 'user=dkdomain.intra\YOURUSERNAME,password=YOURPASSWORD,rw,uid=vagrant,gid=vagrant,file_mode=0777,dir_mode=0777')
Where you replace the capitals with the necessairy info.