git push heroku master - dezalgo - npm ERR!代码ENOENT

时间:2018-01-20 11:35:26

标签: node.js heroku npm

运行 git push heroku master 给出以下错误消息:

remote: Installing any new modules (package.json)  
remote: npm ERR! path  
 /tmp/build_946cfa00bc649e92ea9db4ad388e3eab/node_modules/npm/node_modules/dezalgo
remote: npm ERR! code ENOENT .  
remote: npm ERR! errno -2 .  
remote: npm ERR! syscall rename .  
remote: npm ERR! enoent ENOENT: no such file or directory, rename '/tmp/build_946cfa00bc649e92ea9db4ad388e3eab/node_modules/npm/node_modules/dezalgo' -> '/tmp/build_946cfa00bc649e92ea9db4ad388e3eab/node_modules/npm/node_modules/.dezalgo.DELETE' .  
remote: npm ERR! enoent This is related to npm not being able to find a file.    
remote: npm ERR! enoent .   
remote:       
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /app/.npm/_logs/2018-01-20T11_17_57_014Z-debug.log
remote:  
remote: -----> Build failed

1 个答案:

答案 0 :(得分:0)

确保在项目中首先忽略node_modules,如果不这样做,可以从项目的终端运行这些。

echo 'node_modules' >> .gitignore
git rm -r --cached node_modules
git commit -m "ignore node_modules"

然后再尝试在heroku上部署。