简体   繁体   中英

In jenkins server npm install doesnt work throws an error . Is there any other command to install dependency instead of **npm install**

I have Jenkin server it has a node and npm . I can see the Path of node and npm is /bin/node and /bin/npm . If I try to know the version of both I got it . The version for node is v6.11.1 and npm is 3.10.10 . The Problem i am facing there is if try to run npm install my angular 2 app . The responds shows below exception

+ cd ui
+ npm cache clean
+ npm install
npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code E404

npm ERR! 404 User not found : @angular/platform-browser
npm ERR! 404 
npm ERR! 404  '@angular/platform-browser' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'ui'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

I have tried these command's still doesnt work , commands below are

npm cache clean 
npm config set registry https://registry.npmjs.org/

Below is my angular 2 package.json file ,

{
  "name": "ui",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor",
    "build":"ng build --prod --base-href"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "^3.3.1",
    "@ngx-translate/core": "^7.0.0",
    "@ngx-translate/http-loader": "^0.1.0",
    "bootstrap": "^3.2.0",
    "core-js": "^2.4.1",
    "jquery": "^3.2.1",
    "moment": "^2.18.1",
    "ng2-translate": "^5.0.0",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "^1.1.1",
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3"
  }
}

While I npm update -g my node and npm below error occured ,

+ cd ui
+ npm cache clean
+ npm set registry http://registry.npmjs.org
+ npm update -g
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/asap
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/fstream
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/fstream-npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/normalize-git-url
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/realize-package-specifier
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/columnify/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/npmlog/node_modules/gauge/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/read-package-json/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/request/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/tar/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/dezalgo
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/request/node_modules/tough-cookie
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/strip-ansi
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm/node_modules/write-file-atomic
- asap@2.0.5 node_modules/npm/node_modules/asap
- fstream@1.0.10 node_modules/npm/node_modules/fstream
- fstream-npm@1.2.0 node_modules/npm/node_modules/fstream-npm
- normalize-git-url@3.0.2 node_modules/npm/node_modules/normalize-git-url
- realize-package-specifier@3.0.3 node_modules/npm/node_modules/realize-package-specifier
/usr/lib
└── npm@5.4.0 

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "update" "-g"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules/npm/node_modules/asap
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/asap'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/asap'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules/npm/node_modules/asap' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

Please suggest me If any thing I am doing wrong . Advance Thanks !! .

您的命令正确,只是npm找不到软件包,这主要是由Internet引起的。

maybe you can use the node plugin

to make sure it's not npm version.

if it still doesn't work , try run manually the npm on the Jenkins machine to verify you have all required access to the internet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM