I,m trying to run 'npm run build' but always get error, 'npm run start' command is run correcly,but build command not run.:(
{
"name": "films",
"version": "1.0.0",
"description": "contain about films",
"default": "index.html",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --dist-dir ./dist "
},
"author": "chathura priyashan",
"license": "ISC",
"devDependencies": {
"parcel": "^2.3.2"
},
"dependencies": {
"node-sass": "^7.0.1"
}
}
err--------------------------------------------------
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225501
npm ERR! films#1.0.0 build: `parcel build index.html `
npm ERR! Exit status 3221225501
npm ERR!
npm ERR! Failed at the films#1.0.0 build 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\chathura\AppData\Roaming\npm-cache\_logs\2022-03-28T14_56_48_033Z-debug.log
PS G:\java script sites\Asynchronus\films> npm run build
Related
When I run 'npm install' to install the dependencies from a cloned repository I get the error below from the terminal. I use windows 10
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-scripts#4.0.0
npm ERR! Found: typescript#4.1.3
npm ERR! node_modules/typescript
npm ERR! dev typescript#"4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript#"^3.2.1" from react-scripts#4.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"4.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typescript#3.9.10
npm ERR! node_modules/typescript
npm ERR! peerOptional typescript#"^3.2.1" from react-scripts#4.0.0
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"4.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\USER-PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER-PC\AppData\Local\npm-cache\_logs\2022-10-04T10_18_32_
Even when I ran npm install --legacy-peer-deps I still get same error. Please what could possibly be wrong?
And here's the content in my package.json file:
}
]
"name": "info-site",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "src/index.js",
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "4.0.0"
},
"devDependencies": {
"#babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
The error is telling you that react-scripts#4.0.0 supports typescript#^3.2.1 (i.e. TypeScript >=3.2.1, <4) as a peer dependency.
Your dev dependencies have TypeScript 4 (not 3.2.x) in them, which is not supported by that version of react-scripts, hence the resolution error.
The current version of react-scripts is 5.0.1, so I'd recommend upgrading react-scripts to that version (simply by changing that "4.0.0" in your package.json to "5.0.1") and trying again, since that version declares support for TypeScript 4.
I'm using macOs and even though concurrently is installed globally through npm, when setting it as a start script in package.json and typing npm start the following error occurs.
concurrently - kill-others "npm run server" "npm run client"
sh: concurrently - kill-others: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! thesis_fullstack#1.0.0 start: `concurrently - kill-others "npm run server" "npm run client"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the thesis_fullstack#1.0.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! /Users/mantzaris/.npm/_logs/2020-04-25T22_40_12_897Z-debug.log
My package.json file :
{
"name": "thesis_fullstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"server": "cd server && npm start",
"start": "concurrently - kill-others \"npm run server\" \"npm run client\""
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "3.5.1"
}
}
You need to install the dependency locally in order to use it in any of your start scripts. run
npm install --save concurrently
to install it locally in your project
Your error is not with the package itself, you can either have it globally or save it locally (not --save-dev).
You can find the solution for your problem looking at the error log
concurrently - kill-others "npm run server" "npm run client"
sh: concurrently - kill-others: command not found
The command should be either --kill-others or -k for short, here is the official documentation: https://github.com/kimmobrunfeldt/concurrently
Try this as your package.json
{
"name": "thesis_fullstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"server": "cd server && npm start",
"start": "concurrently --kill-others \"npm run server\" \"npm run client\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"concurrently": "3.5.1"
}
}
Cheers :)
I seriously don't know what I did to fix it. First of all i fixed the command flag "typo" to concurrently --kill-others your_commands_here. Then i uninstalled node manually and reinstalled it through Homebrew (since I'm using MacOs). After that node and npm wouldn't work at all. Fixed it with: https://stackoverflow.com/a/54583099/13212764. I think by that point running npm start worked.
For
Globally -
npm install -g concurrently
Locally -
npm install concurrently
I try to run typescript files with just a package.json file. So a minimum setup for running typescript files.
I just have a singel file: index.ts:
console.clear();
console.log("nic to see you!!");
and package.json file:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}
But if I try to do :
npm start, I will get this error:
Error: Cannot find module 'D:\Mijn Documents\UDEMY\TypeScript\Todo\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Todo#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User.USER-PC\AppData\Roaming\npm-cache\_logs\2019-12-24T11_22_12_024Z-debug.log
PS D:\Mijn Documents\UDEMY\TypeScript\Todo>
So my question is: what I have to change that it will compile?
Thank you
oke, I have it now like this:
packagege.json:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build":"tsc -p ./src",
"start": "npm run build -- -w"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ts-node": "^8.5.4",
"typescript": "^3.7.4"
}
}
And I installed typescript
and I do: npm start. I still get this error:
npm run build -- -w
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc -p ./src "-w"
error TS5057: Cannot find a tsconfig.json file at the specified directory: './src'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 build: `tsc -p ./src "-w"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Todo#1.0.0 build 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\User.USER-PC\AppData\Roaming\npm-cache\_logs\2019-12-24T11_33_38_340Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 start: `npm run build -- -w`
npm ERR! Exit status 1
oke, I have it now like this:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc main.ts dist/",
"start": "npm run build -- -w"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ts-node": "^8.5.4",
"typescript": "^3.7.4"
}
}
and if I do this: npm run. I see this output:
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc main.ts dist/ "-w"
[1:46:58 PM] Starting compilation in watch mode...
error TS6053: File 'dist/.ts' not found.
[1:46:59 PM] Found 1 error. Watching for file changes.
oke, I see now this:
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc -p ./ "-w"
[2:00:31 PM] Starting compilation in watch mode...
[2:00:34 PM] Found 0 errors. Watching for file changes.
But where I can see the results then? Will be nice to go to some port, like: localhost:4200 in the browser, but how to do that?
Try typing in the terminal as follows:
ts-node ./src/index.ts
Or, try the following modifications to the "start" script:
"start": "ts-node ./src/index.ts"
Thank you all!!
the trick was this in the package.json:
"start": "tsc-watch --onsuccess \"node dist/index.js\""
Hope all is well. I'm setting up protractor for the first time through Node.js. This is provided as part of a tutorial on the AngularJS website under "Running E2E Tests":
https://docs.angularjs.org/tutorial
However, while executing protractor through the provided command "npm run protractor", I get the following error within the Node.js command prompt:
E/launcher - Process exited with error code 199
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 protractor: `protractor e2e-tests/protractor.conf.js`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script 'protractor e2e-tests/protractor.conf.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor e2e-tests/protractor.conf.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
Here is the contents on the package.json file:
{
"name": "angular-phonecat",
"private": true,
"version": "0.0.0",
"description": "A tutorial application for AngularJS",
"repository": "https://github.com/angular/angular-phonecat",
"license": "MIT",
"devDependencies": {
"bower": "^1.7.7",
"http-server": "^0.9.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"protractor": "^4.0.9"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server ./app -a localhost -p 8000 -c-1",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor.conf.js",
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/##NG_LOADER_START##[\\s\\S]*\\/\\/##NG_LOADER_END##/).join('//##NG_LOADER_START##\\n'+loaderText+' //##NG_LOADER_END##');fs.writeFileSync(indexFile,indexText);\""
}
}
I don't know if anyone else has tried this same tutorial and is getting the same issue? Any help would be most appreciated, thank you.
So Protractor can be started in several ways, the most common are by directConnect or by seleniumAddress. Since no value was set in the e2e-tests/protractor.config.js file, the assumed value is directConnect. To get directConnect to work with the chrome browser, you'll need to get the latest chromedriver. To just install chromedriver:
./node_modules/.bin/webdriver-manager update --standalone=false --gecko=false
Or as suggested in the github angular-seed page which will download, in addition, the selenium standalone jar file and gecko driver (which is used for firefox):
npm update-webdriver
Trying to run jsHint via script.
package.json:
{
"name": "projectName",
"version": "0.1.0",
"devDependencies": {
"jshint": "^2.9.1"
},
"scripts": {
"lint": "jshint src"
}
}
And get the following error:
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! projectName#0.1.0 lint: `jshint src`
npm ERR! Exit status 2
I resolved this adding "|| true" to the lint line of the script in my package.json file. See below:
{
"name": "projectName",
"version": "0.1.0",
"devDependencies": {
"jshint": "^2.9.1"
},
"scripts": {
"lint": "jshint src || true"
}
}