我已经托管了一个使用实例的NodeJS后端。它过去和现在仍然可以很好地使用旧代码,但是现在如果我想通过部署新代码来更新应用程序,它会给我以下错误:BeanstalkEC2
> phantomjs-prebuilt@2.1.16 install /tmp/deployment/application/node_modules/phantomjs-prebuilt
> node install.js
Considering PhantomJS found at /usr/local/bin/phantomjs
Found PhantomJS at /usr/local/bin/phantomjs ...verifying
Writing location.js file
Error checking path, continuing Error: EACCES: permission denied, open '/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/location.js'
at Object.openSync (fs.js:462:3)
at Object.writeFileSync (fs.js:1362:35)
at writeLocationFile (/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/util.js:84:6)
at Promise._successFn (/tmp/deployment/application/node_modules/phantomjs-prebuilt/install.js:375:11)
at nextTickCallback (/tmp/deployment/application/node_modules/kew/kew.js:47:28)
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/location.js'
}
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1606204791845/phantomjs-2.1.1-linux-x86_64 -> /tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed [Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1606204791845/phantomjs-2.1.1-linux-x86_64' -> '/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom'] {
errno: -13,
code: 'EACCES',
syscall: 'link',
path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1606204791845/phantomjs-2.1.1-linux-x86_64',
dest: '/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom'
} Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1606204791845/phantomjs-2.1.1-linux-x86_64' -> '/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom'
我已经被这种情况困住了 20 天,我已经尝试了来自网络的各种解决方案,但到目前为止都没有奏效。我什至不知道为什么PhantomJS我的代码中有,可能是因为我添加了任何 3rd 方包。
我尝试过的解决方案:
尝试
PhantomJS从我的项目安装/卸载,然后上传。EC2尝试通过访问和使用命令将其安装在Linux 机器上Putty(使用的支持链接 -此处):sudo npm install phantomjs -g //Didn't work sudo npm install phantomjs@2.1.1 -g --unsafe-perm //Didn't work sudo npm install phantomjs-prebuilt@2.1.16 -g --unsafe-perm //Installing globally using NPM support docs mkdir ~/.npm-global npm config set prefix '~/.npm-global' export PATH=~/.npm-global/bin:$PATH source ~/.profile npm install -g phantomjs npm install -g phantomjs-prebuilt NPM_CONFIG_PREFIX=~/.npm-global //also tried this从官方 github repo issue #722尝试了这个解决方案
cd /usr/local/share sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 sudo tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 sudo ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs sudo ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs sudo ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
我也尝试了许多随机解决方案,但到目前为止没有任何效果。没有keypair与我的EC2实例相关联,因此访问它是一个单独的混乱。另外,是的,我是后端开发的新手。
所以,我的问题是如何解决这个PhantomJS问题?