when I run npm install I get a very long error saying error parsing json and continues with the source code of a HTML page that tells me I have a '407 Proxy Authentication Required' error.
The full log can be seen here: http://pastebin.com/T7a4zuYK
this is what npm config list returns:
; cli configs
registry = "http://registry.npmjs.org/"
user-agent = "npm/1.4.28 node/v0.10.34 win32 x64"
; userconfig C:\Users\PV01054\.npmrc
https-proxy = "http://localhost:3128/"
proxy = "http://localhost:3128/"
registry = "http://registry.npmjs.org/"
; builtin config undefined
prefix = "C:\\Users\\PV01054\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\\node.exe
; cwd = C:\Repos\randstad-nl
; HOME = C:\Users\PV01054
; 'npm config ls -l' to show all defaults.
Related
I just use node and npm, I don't need go, python or ruby on netlify build. Can i skip it at netlify build?
I've tried to put it into netlify.toml using variable, like below code :
[build]
command = "pnpm build || ( npm install pnpm && pnpm build )"
publish = "build"
[build.environment ]
NODE_VERSION = "16.14.0"
GO_VERSION = false
RUBY_VERSION = false
PYTHON_VERSION = false
But it will give me error like this
: json: cannot unmarshal bool into Go struct field BuildConfig.Config.build.environment of type string
I am using command ng add #angular/material
Unable to fetch package metadata: Cannot read property 'startsWith' of null is the error I am getting npm config list [-l] [--json];
cli configs metrics-registry = "https://artifacthub-tip.oraclecorp.com/api/npm/npmjs-remote" scope = "" user-agent = "npm/6.12.0 node/v12.13.0 win32 x64";
userconfig C:\Users\goparao\.npmrc
http_proxy = "http://registry.npmjs.org/"
key = "value"
registry = "https://artifacthub-tip.oraclecorp.com/api/npm/npmjs-remote"
strict-ssl = true;
builtin config undefined prefix = "C:\\Users\\goparao\\AppData\\Roaming\\npm"; node bin location = C:\Program Files\nodejs\node.exe ;
cwd = D:\angular_practice\hello-world ;
HOME = C:\Users\goparao ;
"npm config ls -l" to show all defaults.
PS D:\angular_practice\hello-world>
If you still have issues to install Angular Material, you can first install it with the command : npm i #angular/material then run the command ng add #angular\material. (Worked with Angular 10)
I try to create a windows installer for my elctron application but when I run the file I have this error:
spawn mono ENOENT
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! thermowell-design#1.2.0 installer-win: `npm run pack-win && node installers/windows/createinstaller.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the thermowell-design#1.2.0 installer-win script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This is the createinstaller.js file:
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller
const path = require('path')
getInstallerConfig()
.then(createWindowsInstaller)
.catch((error) => {
console.error(error.message || error)
process.exit(1)
})
function getInstallerConfig () {
console.log('creating windows installer')
const rootPath = path.join('./')
const outPath = path.join(rootPath, 'release-builds')
return Promise.resolve({
appDirectory: path.join(outPath, 'Thermowell-Design-win32-x64/'),
authors: 'Pippo',
noMsi: true,
outputDirectory: path.join(outPath, 'windows-installer'),
exe: 'thermowell-design.exe',
setupExe: 'thermowell-design-app.exe',
setupIcon: path.join(rootPath, 'assets', 'images', 'icons', 'logo.ico')
})
}
There are the dependencie version:
electron: 5.0.0-beta.2,
electron-packager: 13.0.1,
electron-winstaller: 2.7.0
end the nodejs version is 10.15.1
It's too late to answer but leaving it for somebody if they need it in future. I got the same problem and here are my fixes:
depending upon my project structure I changed rootPath = path.join(__dirname,'../..')
install mono from https://www.mono-project.com/download/stable/#download-lin-ubuntu
install wine from https://tecadmin.net/install-wine-on-ubuntu/
The two installations are for non-windows platform if your building your installer for windows platform
Those were my fixes but here's another link that might be helpful for you.
I have created a command in package.json file
"create": "ng g component process.env.page --it false"
Now I want to access the passed page argument in the above command so that user can pass the component name to the npm command
I am running the above command as
npm run create --page login
and this runs the
ng g component process.env.page --it false
so new component is created with name process.
How can I access the passed page (login) in my script?
You can use the primitive process.argv or yargs which is a lot more powerful
here is a yargs example
const argv = require("yargs").argv;
let page = argv.page //get the page
The syntax of npm run is:
npm run <command> [-- <args>]
So you need to pass -- before your args. Your command should be as follows:
npm run create -- --page login
const minimist = require('minimist');
let args = minimist(process.argv.slice(2), {
default: {
port: 8080
},
});
run with
npm run start -- --port=8090
args contains
args: { _: [], port: 8090 }
This is the error, doesn't make me install nothing:
npm WARN invalid config https-proxy="http:"
npm WARN invalid config Must be a full url with 'http://'
I try a lot of things:
uninstall/install node and npm
clean npm cache
npm config delete https-proxy
set npm ssl to false
npm config set registry http://registry.npmjs.org/
tried to override it with npm config set https-proxy http://proxy.company.com:8080
open and change manually npmrc global and local files
I get response doing ping to registry.npmjs.org and google.es in console.
Even I uninstall all node and make a new compilation and error persist.
npm config get https-proxy
and
npm config get http-proxy
returns me null both.
my /home/usertv/npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'cordova' ]
2 info using npm#1.3.21
3 info using node#v0.10.24
4 warn invalid config https-proxy="http:"
5 warn invalid config Must be a full url with 'http://'
6 verbose cache add [ 'cordova', null ]
7 verbose cache add name=undefined spec="cordova" args=["cordova",null]
8 verbose parsed url { protocol: null,
8 verbose parsed url slashes: null,
8 verbose parsed url auth: null,
8 verbose parsed url host: null,
8 verbose parsed url port: null,
8 verbose parsed url hostname: null,
8 verbose parsed url hash: null,
8 verbose parsed url search: null,
8 verbose parsed url query: null,
8 verbose parsed url pathname: 'cordova',
8 verbose parsed url path: 'cordova',
8 verbose parsed url href: 'cordova' }
9 silly lockFile a98f2055-cordova cordova
10 verbose lock cordova /root/.npm/a98f2055-cordova.lock
11 silly lockFile a98f2055-cordova cordova
12 silly lockFile a98f2055-cordova cordova
13 verbose addNamed [ 'cordova', '' ]
14 verbose addNamed [ null, '*' ]
15 silly lockFile de8d9fad-cordova cordova#
16 verbose lock cordova# /root/.npm/de8d9fad-cordova.lock
17 silly addNameRange { name: 'cordova', range: '*', hasData: false }
18 verbose url raw cordova
19 verbose url resolving [ 'http://registry.npmjs.org/', './cordova' ]
20 verbose url resolved http://registry.npmjs.org/cordova
21 info trying registry request attempt 1 at 12:25:02
22 http GET http://registry.npmjs.org/cordova
23 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
24 info trying registry request attempt 2 at 12:25:13
25 http GET http://registry.npmjs.org/cordova
26 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
27 info trying registry request attempt 3 at 12:26:13
28 http GET http://registry.npmjs.org/cordova
29 silly lockFile de8d9fad-cordova cordova#
30 silly lockFile de8d9fad-cordova cordova#
31 error network getaddrinfo ENOTFOUND
31 error network This is most likely not a problem with npm itself
31 error network and is related to network connectivity.
31 error network In most cases you are behind a proxy or have bad network settings.
31 error network
31 error network If you are behind a proxy, please make sure that the
31 error network 'proxy' config is set properly. See: 'npm help config'
32 error System Linux 3.2.0-4-686-pae
33 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
34 error cwd /home/usertv
35 error node -v v0.10.24
36 error npm -v 1.3.21
37 error syscall getaddrinfo
38 error code ENOTFOUND
39 error errno ENOTFOUND
40 verbose exit [ 1, true ]
my npm config ls -l
; cli configs
long = true
registry = "http://registry.npmjs.org/"
; userconfig /home/usertv/.npmrc
registry = "http://registry.npmjs.org/"
strict-ssl = false
; globalconfig /usr/local/etc/npmrc
registry = "http://registry.npmjs.org/"
; default values
always-auth = false
bin-links = true
browser = null
cache = "/home/usertv/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cert = null
color = true
depth = null
description = true
dev = false
editor = "vi"
email = null
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
globalconfig = "/usr/local/etc/npmrc"
globalignorefile = "/usr/local/etc/npmignore"
group = 1000
heading = "npm"
https-proxy = null
ignore-scripts = false
init-module = "/home/usertv/.npm-init.js"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
json = false
key = null
link = false
local-address = undefined
loglevel = "http"
; long = false (overridden)
message = "%s"
node-version = "v0.10.24"
npat = false
onload-script = false
optional = true
parseable = false
prefix = "/usr/local"
production = false
proprietary-attribs = true
proxy = null
rebuild-bundle = true
; registry = "https://registry.npmjs.org/" (overridden)
rollback = true
save = false
save-bundle = false
save-dev = false
save-optional = false
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "/bin/bash"
shrinkwrap = true
sign-git-tag = false
; strict-ssl = true (overridden)
tag = "latest"
tmp = "/home/usertv/tmp"
umask = 18
unicode = true
unsafe-perm = true
usage = false
user = 0
user-agent = "node/v0.10.24 linux ia32"
userconfig = "/home/usertv/.npmrc"
username = ""
version = false
versions = false
viewer = "man"
It was a connection problem.
I remember thatI played with proxy configuration by mistake like this :
npm config set proxy http://localhost:8080/
npm config set https-proxy http://localhost:8080/
npm config set strict-ssl false
which made npm client attempts to hit localhost:8080 to pull the module rather than the correct internet endpoint.
so after couple of days of frustration i visited this link
https://docs.npmjs.com/cli/config
then run
npm config edit
which opened a file inside that file i removed those three lines i added above , then everything worked fine.