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

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 ?

Related

Upgrade application to Angular 14 having runtime error

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.

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.

npm run serve/yarn serve is not working upon restarting('node' is not recognized as an internal or external command, operable program or batch file.)

It used to work but when I restarted my PC it won't work anymore. The nodejs directory is set in the Path environmental variable. I tried reinstalling nodejs. I also tried uninstalling #vue folder, running my git bash as administrator, and opening and reopening the terminal. Nothing is currently working. How can I fix this?
Error
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Mariel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using npm#6.0.0
3 info using node#v10.0.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle vue-proj#0.1.0~preserve: vue-proj#0.1.0
6 info lifecycle vue-proj#0.1.0~serve: vue-proj#0.1.0
7 verbose lifecycle vue-proj#0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle vue-proj#0.1.0~serve: PATH: C:\Users\Mariel\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Mariel\Code\vue-proj\node_modules\.bin;C:\Users\Mariel\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Mariel\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Sony\VAIO Improvement;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files\Git\cmd;.;C:\xampp\php";C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs;C:\Users\Mariel\AppData\Local\Microsoft\WindowsApps;C:\Users\Mariel\AppData\Roaming\Composer\vendor\bin;C:\Program Files\nodej;C:\Users\Mariel\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle vue-proj#0.1.0~serve: CWD: C:\Users\Mariel\Code\vue-proj
10 silly lifecycle vue-proj#0.1.0~serve: Args: [ '/d /s /c', 'vue-cli-service serve' ]
11 silly lifecycle vue-proj#0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle vue-proj#0.1.0~serve: Failed to exec serve script
13 verbose stack Error: vue-proj#0.1.0 serve: `vue-cli-service serve`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Mariel\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Mariel\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:947:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
14 verbose pkgid vue-proj#0.1.0
15 verbose cwd C:\Users\Mariel\Code\vue-proj
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mariel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve"
18 verbose node v10.0.0
19 verbose npm v6.0.0
20 error code ELIFECYCLE
21 error errno 1
22 error vue-proj#0.1.0 serve: `vue-cli-service serve`
22 error Exit status 1
23 error Failed at the vue-proj#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 ]
Dependencise(package.json)
{
"name": "vue-proj",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^2.5.16"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^3.0.0-beta.9",
"#vue/cli-plugin-eslint": "^3.0.0-beta.9",
"#vue/cli-service": "^3.0.0-beta.9",
"vue-template-compiler": "^2.5.13"
},
"babel": {
"presets": [
"#vue/app"
]
},
"eslintConfig": {
"root": true,
"extends": [
"plugin:vue/essential",
"eslint:recommended"
]
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
re-install the npm package manager
or update node to LTS Version

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/