2017-11-25 29 views
0

我正在經歷一個奇怪的情況。我在macOS Sierra 10.12.3中獲得了一個節點應用程序。我也得到了以下信息:爲什麼npm install命令在節點應用程序中一次又一次地重新運行?

節點-v顯示V8.4.0 NPM -v顯示5.3.0

該文件的package.json:

{ 
    "name": "myapp", 
    "version": "1.0.1", 
    "description": "My Node App", 
    "main": "app.js", 
    "scripts": { 
    "install": "npm install", 
    "test": "echo \"Error: no test specified\" && exit 1", 
    "start": "node app.js" 
    }, 
    "engines": { 
    "node": ">=6" 
    }, 
    "author": "blackjack", 
    "license": "ISC", 
    "dependencies": { 
    "angular": "^1.5.8" 
    } 
} 

當我運行 「故宮安裝」爲了安裝依賴關係,這些依賴關係被安裝,然而,「npm install」重新運行。事實上,它永遠不會停止運行。

看看這個:

pathfinder:myapp blackjack$ npm install --loglevel verbose 
npm info it worked if it ends with ok 
npm verb cli [ '/usr/local/bin/node', 
npm verb cli '/usr/local/bin/npm', 
npm verb cli 'install', 
npm verb cli '--loglevel', 
npm verb cli 'verbose' ] 
npm info using [email protected] 
npm info using [email protected] 
npm verb npm-session 0695436488c367c7 
npm info lifecycle [email protected]~preinstall: [email protected] 
npm verb correctMkdir /Users/blackjack/.npm/_locks correctMkdir not in flight; initializing 
npm verb lock using /Users/blackjack/.npm/_locks/staging-e02d0e92bf103f5a.lock for /Users/blackjack/dev/web/myapp/node_modules/.staging 
npm verb unlock done using /Users/blackjack/.npm/_locks/staging-e02d0e92bf103f5a.lock for /Users/blackjack/dev/web/myapp/node_modules/.staging 
npm info linkStuff [email protected] 
npm verb linkBins [email protected] 
npm verb linkMans [email protected] 
npm info lifecycle [email protected]~install: [email protected] 

> [email protected] install /Users/blackjack/dev/web/myapp 
> npm install 

npm info it worked if it ends with ok 
npm verb cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ] 
npm info using [email protected] 
npm info using [email protected] 
npm verb npm-session aeb46163714f97fa 
npm info lifecycle [email protected]~preinstall: [email protected] 
npm verb correctMkdir /Users/blackjack/.npm/_locks correctMkdir not in flight; initializing 
npm verb lock using /Users/blackjack/.npm/_locks/staging-e02d0e92bf103f5a.lock for /Users/blackjack/dev/web/myapp/node_modules/.staging 
npm verb unlock done using /Users/blackjack/.npm/_locks/staging-e02d0e92bf103f5a.lock for /Users/blackjack/dev/web/myapp/node_modules/.staging 
npm info linkStuff [email protected] 
npm verb linkBins [email protected] 
npm verb linkMans [email protected] 
npm info lifecycle [email protected]~install: [email protected] 

> [email protected] install /Users/blackjack/dev/web/myapp 
> npm install 

^C 

它永遠不會打印 「OK」,告訴它的工作如預期。 應用程序在「node app.js」命令後運行正常。但是,它阻止了AWS Beanstalk中的安裝。我看不到任何打印錯誤。

回答

1

從package.json中刪除"install": "npm install",

正如您在the document中看到的那樣,npm在安裝軟件包後運行一個指定的命令。所以在這裏指定npm install將永遠運行npm install

相關問題