Upgrade application to Angular 14 having runtime error - angular14

An angular 9.x project which consumes two libraries. Recently upgraded all to Angular 14.0 step by step. All are compiling fine but after consuming libs in the application and running it throws this error :
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Julia.Kabirian\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start',
1 verbose cli 'leap',
1 verbose cli 'au',
1 verbose cli 'dev',
1 verbose cli 'au_08052_jk'
1 verbose cli ]
2 info using npm#6.14.17
3 info using node#v14.15.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle content-apps-au#0.0.0~prestart: content-apps-au#0.0.0
6 info lifecycle content-apps-au#0.0.0~start: content-apps-au#0.0.0
7 verbose lifecycle content-apps-au#0.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle content-apps-au#0.0.0~start: PATH: C:\Users\Julia.Kabirian\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Julia.Kabirian\projects\content-apps-au\node_modules\.bin;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\WindowsPowerShell\Scripts;C:\Program Files\dotnet\;C:\Users\Julia.Kabirian\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\PuTTY\;C:\Program Files\PowerShell\7\;C:\Program Files\Git\cmd;C:\Program Files (x86)\dotnet\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Users\Julia.Kabirian\AppData\Local\Microsoft\WindowsApps;C:\Users\Julia.Kabirian\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Julia.Kabirian\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\Julia.Kabirian\.dotnet\tools;C:\Users\Julia.Kabirian\AppData\Roaming\npm
9 verbose lifecycle content-apps-au#0.0.0~start: CWD: C:\Users\Julia.Kabirian\projects\content-apps-au
10 silly lifecycle content-apps-au#0.0.0~start: Args: [ '/d /s /c', 'npx task client "leap" "au" "dev" "au_08052_jk"' ]
11 silly lifecycle content-apps-au#0.0.0~start: Returned: code: 1 signal: null
12 info lifecycle content-apps-au#0.0.0~start: Failed to exec start script
13 verbose stack Error: content-apps-au#0.0.0 start: `npx task client "leap" "au" "dev" "au_08052_jk"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Julia.Kabirian\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Julia.Kabirian\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid content-apps-au#0.0.0
15 verbose cwd C:\Users\Julia.Kabirian\projects\content-apps-au
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Julia.Kabirian\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start" "leap" "au" "dev" "au_08052_jk"
18 verbose node v14.15.1
19 verbose npm v6.14.17
20 error code ELIFECYCLE
21 error errno 1
22 error content-apps-au#0.0.0 start: `npx task client "leap" "au" "dev" "au_08052_jk"`
22 error Exit status 1
23 error Failed at the content-apps-au#0.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
here is my package.json:
{
"name": "my-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"task": "node ./node_modules/#company/project/scripts/tasksfile.js",
"postinstall": "ngcc && npx task proxy",
"start": "npx task client",
"build": "npx task build",
"prettier": "npx task prettier",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "14.1.0",
"#angular/cdk": "14.1.0",
"#angular/common": "14.1.0",
"#angular/compiler": "14.1.0",
"#angular/core": "14.1.0",
"#angular/forms": "14.1.0",
"#angular/material": "14.1.0",
"#angular/platform-browser": "14.1.0",
"#angular/platform-browser-dynamic": "14.1.0",
"#angular/router": "14.1.0",
"#leapdev/my-app-lib": "4.10.32",
"#leapdev/gui": "^0.2.260",
"#leapdev/gui-icons": "2.0.28",
"#leapdev/gui4d": "0.1.1",
"#microsoft/office-js-helpers": "0.8.0-beta.4",
"#ngrx/effects": "14.0.2",
"#ngrx/entity": "14.0.2",
"#ngrx/store": "14.0.2",
"#ngrx/store-devtools": "14.0.2",
"bootstrap": "^4.3.1",
"buffer": "5.6.0",
"ng-inline-svg": "10.1.0",
"ng-node-environment": "^1.1.1",
"ngrx-store-logger": "0.2.4",
"ngx-logger": "4.1.9",
"ngx-monaco-editor": "^9.0.0",
"node-sass": "^4.12.0",
"rxjs": "6.6.3",
"stream": "0.0.2",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "14.1.0",
"#angular/cli": "14.1.0",
"#angular/compiler-cli": "14.1.0",
"#angular/language-service": "14.1.0",
"#types/googlemaps": "3.39.3",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "2.0.8",
"#types/jquery": "^3.3.29",
"#types/jszip": "0.0.33",
"#types/jwt-decode": "2.2.1",
"#types/lodash-es": "4.17.3",
"#types/node": "13.9.8",
"#types/office-js": "1.0.123",
"#types/uuid": "3.4.3",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"prettier": "1.18.2",
"protractor": "~7.0.0",
"tasksfile": "5.1.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.0",
"tslint-config-prettier": "1.18.0",
"typescript": "4.6.4"
}
}
my node and npm versions are as follows:
npm --version
6.14.17
node --version
v14.15.1
Any help will be appreciated.

Related

Build error running vue.js web application in Visual Studio 2019

I created a "Basic Vue.js Web Application" in Visual Studio 2019, and as soon as I attempt to run the web application on Chrome (without adding or changing anything at all inside the solution), it notifies me that it was "built with errors". The error shown is: The Command " npm run build " exited with code 1. from the file Microsoft.Common.CurrentVersion.targets as you can see in the following image:
Log file:
0 info it worked if it ends with ok
1 verbose cli [
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 'build'
1 verbose cli ]
2 info using npm#6.14.5
3 info using node#v12.18.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle vuejs-app2#0.1.0~prebuild: vuejs-app2#0.1.0
6 info lifecycle vuejs-app2#0.1.0~build: vuejs-app2#0.1.0
7 verbose lifecycle vuejs-app2#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle vuejs-app2#0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Bryan2\source\repos\VuejsApp2\node_modules\.bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\nodejs\;C:\Users\Bryan2\AppData\Local\Microsoft\WindowsApps;C:\Users\Bryan2\.dotnet\tools;C:\Users\Bryan2\AppData\Roaming\npm
9 verbose lifecycle vuejs-app2#0.1.0~build: CWD: C:\Users\Bryan2\source\repos\VuejsApp2
10 silly lifecycle vuejs-app2#0.1.0~build: Args: [ '/d /s /c', 'vue-cli-service build' ]
11 silly lifecycle vuejs-app2#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle vuejs-app2#0.1.0~build: Failed to exec build script
13 verbose stack Error: vuejs-app2#0.1.0 build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid vuejs-app2#0.1.0
15 verbose cwd C:\Users\Bryan2\source\repos\VuejsApp2
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.18.2
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error vuejs-app2#0.1.0 build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the vuejs-app2#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I previously built a vue.js web application from visual code as the frontend while using ASP.NET Core as the backend in Visual Studio 2017 on another machine, and I'm trying to get the knack of Visual Studio 2019 and its updates on my new machine. What could I do to solve this problem?
EDIT
Here is the package.json as requested:
{
"name": "test1-vue",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"description": "Test1Vue",
"author": {
"name": ""
},
"dependencies": {
"axios": "0.19.2",
"chart.js": "2.9.3",
"core-js": "3.6.5",
"file-saver": "2.0.2",
"html2canvas": "1.0.0-rc.5",
"jspdf": "1.4.1",
"jspdf-autotable": "3.5.6",
"vue": "2.5.17",
"vue-chartjs": "3.5.0",
"vue-router": "3.3.4",
"vuetify": "2.3.4",
"vuex": "3.5.1"
},
"devDependencies": {
"#vue/cli-plugin-babel": "3.0.4",
"#vue/cli-plugin-eslint": "3.0.4",
"#vue/cli-plugin-vuex": "4.4.6",
"#vue/cli-service": "3.0.4",
"eslint": "5.6.0",
"eslint-plugin-vue": "4.7.1",
"sass": "1.26.10",
"sass-loader": "9.0.2",
"vue-cli-plugin-vuetify": "2.0.7",
"vue-template-compiler": "2.5.17",
"vuetify-loader": "1.3.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Visual Studio 2019 automatically installs the project's NPM modules upon opening the generated project. However, the process is relatively slow (slower than on command line with Surface Pro, i5-8250U 1.6/1.8 GHz, 8GB RAM), and there is no obvious UI indicator for the installation progress, so it's easy to overlook this pending state.
Oddly, Visual Studio allows you to try starting a build before the NPM module installation completes, in which case you'd notice errors related to missing modules (like the one you observed with vue-cli-service).
A workaround is to wait until the module installation completes, indicated by the Output window or Solution Explorer.
Output window
Open the Output window with CtrlAltO, and select Npm from the Show output from dropdown.
Installing: Notice Executing command 'npm install'.
Done: Notice npm command completed with exit code 0.
Solution Explorer
Open Solution Exporer with CtrlAltL, and expand the npm item.
Installing: Notice the npm's context menu disables Install npm Packages and Update npm Packages:
...and the NPM modules are shown with a yellow warning icon and a "(missing)" label:
Done: Notice the NPM module icons change to an orange icon, and the label to "(dev)":

undefined is not a function (evaluating 'react.default.createContext((0,_getTheme.default)())')

I was using babel-preset-react-native in the dependency which has been deprecated instead "metro-react-native-babel-preset": "^0.47.0" is now being used. So, I updated the same and also updated .babelrc file with the below code:
{
"presets": ["module:metro-react-native-babel-preset"]
}
The above code resolved the issue which I was getting in this link error: bundling failed: TypeError: Cannot read property 'bindings' of null but after loading 100%, the app gives different red screen which I am sharing below:
Error Log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm#5.6.0
3 info using node#v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ExampleApp#0.0.1~prestart: ExampleApp#0.0.1
6 info lifecycle ExampleApp#0.0.1~start: ExampleApp#0.0.1
7 verbose lifecycle ExampleApp#0.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle ExampleApp#0.0.1~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/manish/Desktop/Practice/donut/node_modules/.bin:/home/manish/bin:/home/manish/.local/bin:/opt/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/java/jdk1.8.0_161/bin:/snap/bin:/home/manish/Android/Sdk/tools:/home/manish/Android/Sdk/platform-tools:/opt/maven/bin:/opt/android-studio/gradle/gradle-4.5/bin:/android-studio/gradle/gradle-4.5/bin:/home/manish/Android/Sdk/tools:/home/manish/Android/Sdk/platform-tools:/usr/local/apache-maven-3.5.2/bin:/opt/android-studio/gradle/gradle-4.5/bin:/android-studio/gradle/gradle-4.5/bin
9 verbose lifecycle ExampleApp#0.0.1~start: CWD: /home/manish/Desktop/Practice/donut
10 silly lifecycle ExampleApp#0.0.1~start: Args: [ '-c',
10 silly lifecycle 'node node_modules/react-native/local-cli/cli.js start' ]
11 silly lifecycle ExampleApp#0.0.1~start: Returned: code: 137 signal: null
12 info lifecycle ExampleApp#0.0.1~start: Failed to exec start script
13 verbose stack Error: ExampleApp#0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
13 verbose stack Exit status 137
13 verbose stack at EventEmitter.<anonymous> (/usr/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> (/usr/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 ExampleApp#0.0.1
15 verbose cwd /home/manish/Desktop/Practice/donut
16 verbose Linux 4.15.0-34-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 137
22 error ExampleApp#0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
22 error Exit status 137
23 error Failed at the ExampleApp#0.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 137, true ]
package.json
{
"name": "ExampleApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"amazon-cognito-identity-js": "^1.31.0",
"aws-sdk": "^2.177.0",
"aws4-react-native": "0.0.2",
"axios": "^0.16.2",
"babel-preset-es2015": "^6.24.1",
"google-libphonenumber": "^2.0.9",
"react": "16.0.0-alpha.12",
"react-native": "0.57.1",
"react-native-camera": "^0.10.0",
"react-native-display": "^1.0.8",
"react-native-doc-viewer": "^2.6.3",
"react-native-exit-app": "^1.0.0",
"react-native-fetch-blob": "^0.10.8",
"react-native-file-picker": "0.0.8",
"react-native-file-provider": "^1.1.0",
"react-native-fs": "^2.5.1",
"react-native-google-analytics-bridge": "^5.6.1",
"react-native-image-gallery": "^2.1.4",
"react-native-image-resizer": "^1.0.0",
"react-native-immersive": "^1.1.0",
"react-native-indicators": "^0.10.0",
"react-native-localization": "^0.2.1",
"react-native-material-textfield": "^0.10.0",
"react-native-material-ui": "^1.13.0",
"react-native-mime-types": "^2.2.1",
"react-native-orientation": "^3.1.3",
"react-native-share": "^1.0.23",
"react-native-uuid": "^1.4.9",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.3",
"react-side-effect": "^1.1.3",
"realm": "^2.0.0"
},
"devDependencies": {
"#babel/preset-env": "^7.1.0",
"#babel/runtime": "^7.0.0",
"babel-jest": "20.0.3",
"jest": "20.0.4",
"metro-react-native-babel-preset": "^0.47.0",
"react-test-renderer": "16.0.0-alpha.12",
"schedule": "^0.4.0"
},
"jest": {
"preset": "react-native"
}
}
What's the mistake and why this error is coming ? am i missing something ?

Unable to start webpack-dev-server

I am attempting to do a React tutorial, and although I have downloaded files from the instructor, I am unable to start the web-dev-server on my laptop. I can, however, get it to work on my desktop computer. I will need to be able to work on my laptop, though, so I would appreciate any help in figuring out what's wrong. I have tried deleting and re-installing the the node_modules folder (many times), as well as deleting just the webpack-dev-server folder and re-installing that. As far as I can tell no other program is using the same port (8080).
Here is the error log I get:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#6.4.0
3 info using node#v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle github-battle#1.0.0~prestart: github-battle#1.0.0
6 info lifecycle github-battle#1.0.0~start: github-battle#1.0.0
7 verbose lifecycle github-battle#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle github-battle#1.0.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/eleerogers/Downloads/react-fundamentals-first-component/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle github-battle#1.0.0~start: CWD: /Users/eleerogers/Downloads/react-fundamentals-first-component
10 silly lifecycle github-battle#1.0.0~start: Args: [ '-c', 'webpack-dev-server --open' ]
11 silly lifecycle github-battle#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle github-battle#1.0.0~start: Failed to exec start script
13 verbose stack Error: github-battle#1.0.0 start: `webpack-dev-server --open`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304: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> (/usr/local/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 github-battle#1.0.0
15 verbose cwd /Users/eleerogers/Downloads/react-fundamentals-first-component
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v8.11.3
19 verbose npm v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error github-battle#1.0.0 start: `webpack-dev-server --open`
22 error Exit status 1
23 error Failed at the github-battle#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Here is the webpack.config.js:
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './app/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index_bundle.js'
},
module: {
rules: [
{ test: /\.(js)$/, use: 'babel-loader' },
{ test: /\.css$/, use: [ 'style-loader', 'css-loader' ]}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'app/index.html'
})
],
mode: "development"
};
And here is the package.json:
{
"name": "github-battle",
"version": "1.0.0",
"description": "Project for TylerMcGinnis.com's fundamental course.",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --open"
},
"author": "Tyler McGinnis",
"license": "MIT",
"babel": {
"presets": [
"env",
"react"
]
},
"dependencies": {
"react": "^16.0.0-alpha.5",
"react-dom": "^16.0.0-alpha.5"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.11",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.21.0",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.4",
"webpack-dev-server": "^3.1.5"
}
}
Although, as I said, it works on my desktop, so I don't think it's anything wrong with those... something is going on with my laptop. It is a new Macbook Air. Thanks for any help!
npm clean cache
then
npm install
This should solve your problem.

vuejs 2 : npm ERR! Could not install from "#/config" as

I have :
$ nodejs --version
v8.9.4
$ npm --version
5.6.0
I try to join that https://github.com/wxs77577/adminify vuejs/vuetify template with latest laravel.
I do as next:
1) laravel new Songs
2) cd Songs
php artisan --version
Laravel Framework 5.6.8
3) I copied all files from adminify/src/ into /resources/assets/js/ in Songs project folder
4) I modified my webpack.mix.js as :
let mix = require('laravel-mix');
mix.js('resources/assets/js/main.js', 'public/js') // main.js is entry point of the project
.sass('resources/assets/sass/app.scss', 'public/css');
5) Into my resources/assets/js/http.js I added axios headers configuration from Laravel's resources/assets/js/bootstrap.js, so it has content :
import Vue from 'vue'
import axios from 'axios'
import config from './config'
// enable mock
// import mock from './mock'
// if (!config.debug.mock) {
// mock.restore()
// }
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
var http = axios.create({
baseURL: config.api,
timeout: 1000
// headers: { 'Authorization': 'Bearer ' + localStorage.getItem('token') }
})
http.interceptors.request.use(function (request) {
return request
}, function (error) {
// Do something with request error
return Promise.reject(error)
})
http.interceptors.response.use(function (response) {
const request = response.config
if (config.debug.http) {
console.log(
'>>>', request.method.toUpperCase(), request.url, request.params,
'\n ', response.status, response.data
)
}
return response
}, function (error) {
if (config.debug.http) {
let { response, config: request } = error
if (request) {
console.log(
'>>>', request.method.toUpperCase(), request.url, request.params,
'\n ', response.status, response.data
)
}
}
// Do something with response error
return Promise.reject(error)
})
Vue.prototype.$http = http
6) In package.json I added dependencies from adminify/package.json, so now my /package.json has content :
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"adonis-websocket-client": "^1.0.2",
"babel-runtime": "^6.23.0",
"i": "^0.3.5",
"indicative": "^2.2.1",
"vue": "^2.3.3",
"vue-i18n": "^6.1.1",
"vue-quill-editor": "^2.1.6",
"vue-router": "^2.3.1",
"vue-timeago": "^3.3.1",
"vue2-dropzone": "^2.0.0"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"popper.js": "^1.12",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"vue": "^2.5.7"
"Validator": "^1.0.4",
"autoprefixer": "^6.7.2",
"axios-mock-adapter": "^1.8.1",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^1.1.3",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^2.0.7",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"indicative": "^2.2.1",
"mockjs": "^1.0.1-beta3",
"opn": "^4.0.2",
"optimize-css-assets-webpack-plugin": "^1.3.0",
"ora": "^1.2.0",
"pug": "^2.0.0-rc.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"style-loader": "^0.13.1",
"stylus": "^0.54.5",
"stylus-loader": "^2.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"vuetify": "^0.14",
"vuex": "^2.3.1",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
}
}
7) After that I run
$ npm install
npm WARN The package vue is included as both a dev and production dependency.
npm WARN The package indicative is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
8) and last :
$ npm run watch-poll
> # watch-poll /mnt/_work_sdb8/wwwroot/lar/Songs
> npm run watch -- --watch-poll
> # watch /mnt/_work_sdb8/wwwroot/lar/Songs
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch-poll"
10% building modules 1/1 modules 0 active
Webpack is watching the files…
78% advanced chunk optimization/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:188
chunk.sortModules();
^
TypeError: chunk.sortModules is not a function
at /mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:188:19
at /mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/async/dist/async.js:3096:16
at eachOfArrayLike (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/async/dist/async.js:1055:9)
at eachOf (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/async/dist/async.js:1103:5)
at Object.eachLimit (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/async/dist/async.js:3158:5)
at Compilation.<anonymous> (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/laravel-mix/node_modules/extract-text-webpack-plugin/dist/index.js:184:27)
at Compilation.applyPluginsAsyncSeries (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/tapable/lib/Tapable.js:206:13)
at Compilation.seal (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/webpack/lib/Compilation.js:579:8)
at /mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/webpack/lib/Compiler.js:493:16
at /mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/tapable/lib/Tapable.js:289:11
at _addModuleChain (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch-poll"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch 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/serge/.npm/_logs/2018-03-07T12_24_13_366Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch-poll 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/serge/.npm/_logs/2018-03-07T12_24_13_388Z-debug.log
Content of 018-03-07T12_33_56_015Z-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'development' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle #~predevelopment: #
6 info lifecycle #~development: #
7 verbose lifecycle #~development: unsafe-perm in lifecycle true
8 verbose lifecycle #~development: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/Songs/node_modules/.bin:/home/serge/.composer/vendor/bin:/home/serge/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle #~development: CWD: /mnt/_work_sdb8/wwwroot/lar/Songs
10 silly lifecycle #~development: Args: [ '-c',
10 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle #~development: Returned: code: 1 signal: null
12 info lifecycle #~development: Failed to exec development script
13 verbose stack Error: # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/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> (/usr/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 #
15 verbose cwd /mnt/_work_sdb8/wwwroot/lar/Songs
16 verbose Linux 4.13.0-36-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "development"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the # development script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
You have a problem with your webpack configuration. A couple of options:
Fix the imports
In ./resources/assets/js/i18n/index.js:
Replace:
import config from '#/config'
with:
import config from '../config'
And in /resources/assets/js/main.js:
Replace:
import '#/styles/main.styl'
with:
import './styles/main.styl'
Try the above. If it doesn't work, undo it and try the one below.
Alternative: Changing webpack config
If you are going to try this option, undo the suggested changes above.
To update your webpack config, in your webpack.mix.js, which is like:
let mix = require('laravel-mix');
mix.js('resources/assets/js/main.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
Add a mix.webpackConfig({, making it like:
let mix = require('laravel-mix');
mix.webpackConfig({
resolve:{
/* Path Shortcuts */
alias:{
'#': path.resolve(__dirname, 'resources/assets/js')
}
}
})
mix.js('resources/assets/js/main.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');

Angular 2 beta "npm run tsc" Command fails

I can't seem to compile my Typescript using the npm run ts" command.
What i find a little weird is that i can run the npm start and that way it compiles and runs fine.
The log is below:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'tsc' ]
2 info using npm#2.11.3
3 info using node#v0.12.7
4 verbose run-script [ 'pretsc', 'tsc', 'posttsc' ]
5 info pretsc MyProject#1.0.0
6 info tsc MyProject#1.0.0
7 verbose unsafe-perm in lifecycle true
8 info MyProject#1.0.0 Failed to exec tsc script
9 verbose stack Error: MyProject#1.0.0 tsc: `tsc`
9 verbose stack Exit status 2
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid MyProject#1.0.0
11 verbose cwd /Users/kasperlaursen/adnexio.frontend
12 error Darwin 15.3.0
13 error argv "node" "/usr/local/bin/npm" "run" "tsc"
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error MyProject#1.0.0 tsc: `tsc`
17 error Exit status 2
18 error Failed at the MyProject#1.0.0 tsc script 'tsc'.
18 error This is most likely a problem with the MyProject package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error tsc
18 error You can get their info via:
18 error npm owner ls MyProject
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "./bin"
},
"exclude": [
"node_modules"
]
}
PACKAGE.JSON:
{
"name": "MyProject",
"version": "1.0.0",
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.3",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.11"
},
"devDependencies": {
"concurrently": "^1.0.0",
"lite-server": "^2.0.1",
"typescript": "^1.7.5"
}
}
You probably install your dependencies using the "npm install". This means that they aren't in the path. That's why using the tsc command directly doesn't work.
When using "npm run start", I suspect concurrent to do something with the path to able to use libraires like typescript (and its tsc command) from the node_modules folder.
Something like "$(npm bin)" does when used like that:
> $(npm bin)/tsc
See this question for more details:
How to use package installed locally in node_modules?
This article could also interest you:
http://www.jayway.com/2014/03/28/running-scripts-with-npm/