Installed create-react-native-app and used it to create my application.
Everything worked fine until i've installed react-navigation like in tutorial npm install --save react-navigation
My project won't even start. I haven't made any changes in it. I just installed this package.
package.json
{
"name": "EliteEl",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.10.0",
"jest-expo": "25.0.0",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0",
"react-navigation": "^1.0.0-beta.27"
}
}
Error 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#5.5.1
3 info using node#v9.2.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle EliteEl#0.1.0~prestart: EliteEl#0.1.0
6 info lifecycle EliteEl#0.1.0~start: EliteEl#0.1.0
7 verbose lifecycle EliteEl#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle EliteEl#0.1.0~start: PATH: C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin;E:\xampp\htdocs\lessons\REACT\EliteEl\node_modules\.bin;E:\Soft\Embarcadero\Studio\19.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl;E:\Soft\Embarcadero\Studio\19.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Win64;E:\Soft\cuda\soft\bin;E:\Soft\cuda\soft\libnvvp;C:\ProgramData\Oracle\Java\javapath;E:\Soft\Anaconda3;E:\Soft\Anaconda3\Library\mingw-w64\bin;E:\Soft\Anaconda3\Library\usr\bin;E:\Soft\Anaconda3\Library\bin;E:\Soft\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\PuTTY\;C:\Go\bin;C:\Program Files (x86)\Yarn\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\Git\cmd;C:\Users\ykemer.SPA\AppData\Roaming\Composer\vendor\bin;C:\Users\ykemer.SPA\AppData\Roaming\npm;C:\Users\ykemer.SPA\AppData\Local\Yarn\bin
9 verbose lifecycle EliteEl#0.1.0~start: CWD: E:\xampp\htdocs\lessons\REACT\EliteEl
10 silly lifecycle EliteEl#0.1.0~start: Args: [ '/d /s /c', 'react-native-scripts start' ]
11 silly lifecycle EliteEl#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle EliteEl#0.1.0~start: Failed to exec start script
13 verbose stack Error: EliteEl#0.1.0 start: `react-native-scripts start`
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:280:16)
13 verbose stack at EventEmitter.emit (events.js:159:13)
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:159:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid EliteEl#0.1.0
15 verbose cwd E:\xampp\htdocs\lessons\REACT\EliteEl
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v9.2.0
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error EliteEl#0.1.0 start: `react-native-scripts start`
22 error Exit status 1
23 error Failed at the EliteEl#0.1.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 ]
Error in console
Error: React native is not installed. Please run `npm install` in your project directory.
16:36:47: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at C:\xdl\src\Project.js:1291:11
at Generator.next (<anonymous>)
at step (C:\Users\ykemer.SPA\AppData\Roaming\npm\node_modules\react-native-scripts\node_modules\xdl\build\Project.js:1679:191)
at C:\Users\ykemer.SPA\AppData\Roaming\npm\node_modules\react-native-scripts\node_modules\xdl\build\Project.js:1679:361
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! EliteEl#0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the EliteEl#0.1.0 start 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! C:\Users\ykemer.SPA\AppData\Roaming\npm-cache\_logs\2018-01-24T12_36_47_683Z-debug.log
I don't know why, but it doesn't accept globally installed package.
So i had to run npm install and then everything was good
Related
i'm attempting to run a react native app in a monorepo using pnpm. I added it to pnpm-workspace.yaml file defined as:
packages:
- "apps/*"
When i attempt to run npm i or pnpm i i kept getting the error below:
> sample_project#0.0.1 prepare
> cd .. && husky install frontend/.husky
line 2: husky: command not found
I have husky defined in the root folder(within pnpm-workspace.yaml). Also i declared a .npmrc file that included node-linker=hoisted but still no luck. I also ran pnpm i within the root directory but failed to install node_modules dir within the mobile directory. Please help needed. How does one run a react native app within a monorepo with pnpm? Any help will be appreciated.
Edit
I have husky defined in the root directory as:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd frontend
pnpm run pre-commit
and in my package.json file:
{
"name": "sample_project",
"version": "0.0.1",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"test": "turbo run test",
"test:lint": "turbo run test:lint",
"fix": "turbo run fix",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"prepare": "cd .. && husky install frontend/.husky",
"pre-commit": "turbo run fix"
},
"devDependencies": {
"prettier": "latest",
"turbo": "latest",
"husky": "latest",
"lint-staged": "latest"
},
"engines": {
"npm": ">=7.0.0",
"node": ">=14.0.0"
},
"packageManager": "pnpm#7.0.1"
}
When i run the command npm i --loglevel verbose within the mobile directory below is the following errors:
> sample_project#0.0.1 prepare
> cd .. && husky install frontend/.husky
/var/folders/r5/n6lp6wsj2c52h51xxsdgw7y00000gn/T/prepare6589946269.sh: line 2: husky: command not found
npm timing command:i Completed in 54463ms
npm verb stack Error: command failed
npm verb stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/lib/index.js:63:27)
npm verb stack at ChildProcess.emit (node:events:513:28)
npm verb stack at maybeClose (node:internal/child_process:1091:16)
npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid ***#0.0.1
npm verb cwd /Users/***/***/***/***/***/****
npm verb Darwin 21.5.0
npm verb node v18.6.0
npm verb npm v8.13.2
npm ERR! code 127
npm ERR! path /Users/***/***/***/***
npm ERR! command failed
npm ERR! command sh -c /var/folders/r5/n6lp6wsj2c52h51xxsdgw7y00000gn/T/prepare6589946269.sh
npm verb exit 127
npm timing npm Completed in 54564ms
npm verb code 127
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)":
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.
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
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/