之前我已在此计算机上安装了phantomjs,但现在它无法找到可执行文件。所以我卸载了它(npm uninstall phantomjs
,npm uninstall phantomjs-prebuild
)。
但安装它并不起作用。有人可以告诉我为什么/如何解决它?
$ sudo -H npm -g install phantomjs-prebuilt
/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs-prebuilt/bin/phantomjs
> phantomjs-prebuilt@2.1.15 install /usr/lib/node_modules/phantomjs-prebuilt
> node install.js
Considering PhantomJS found at /usr/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
[=======================================-] 98%
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1505979849548/phantomjs-2.1.1-linux-x86_64 -> /usr/lib/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-1505979849548/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom'
at Error (native)
errno: -13,
code: 'EACCES',
syscall: 'link',
path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1505979849548/phantomjs-2.1.1-linux-x86_64',
dest: '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1505979849548/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom'
at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.15 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-21T07_44_13_695Z-debug.log
日志给出:
2467 silly install phantomjs-prebuilt@2.1.15
2468 info lifecycle phantomjs-prebuilt@2.1.15~install: phantomjs-prebuilt@2.1.15
2469 verbose lifecycle phantomjs-prebuilt@2.1.15~install: unsafe-perm in lifecycle false
2470 verbose lifecycle phantomjs-prebuilt@2.1.15~install: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/usr/lib/node_modules/phantomjs-prebuilt/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2471 verbose lifecycle phantomjs-prebuilt@2.1.15~install: CWD: /usr/lib/node_modules/phantomjs-prebuilt
2472 silly lifecycle phantomjs-prebuilt@2.1.15~install: Args: [ '-c', 'node install.js' ]
2473 silly lifecycle phantomjs-prebuilt@2.1.15~install: Returned: code: 1 signal: null
2474 info lifecycle phantomjs-prebuilt@2.1.15~install: Failed to exec install script
2475 verbose unlock done using /root/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
2476 verbose stack Error: phantomjs-prebuilt@2.1.15 install: `node install.js`
2476 verbose stack Exit status 1
2476 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
2476 verbose stack at emitTwo (events.js:106:13)
2476 verbose stack at EventEmitter.emit (events.js:191:7)
2476 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2476 verbose stack at emitTwo (events.js:106:13)
2476 verbose stack at ChildProcess.emit (events.js:191:7)
2476 verbose stack at maybeClose (internal/child_process.js:891:16)
2476 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
2477 verbose pkgid phantomjs-prebuilt@2.1.15
2478 verbose cwd /tmp
2479 verbose Linux 4.10.0-33-generic
2480 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "-g" "install" "phantomjs-prebuilt"
2481 verbose node v6.11.2
2482 verbose npm v5.4.2
2483 error code ELIFECYCLE
2484 error errno 1
2485 error phantomjs-prebuilt@2.1.15 install: `node install.js`
2485 error Exit status 1
2486 error Failed at the phantomjs-prebuilt@2.1.15 install script.
2486 error This is probably not a problem with npm. There is likely additional logging output above.
2487 verbose exit [ 1, true ]
答案 0 :(得分:5)
快速修复:
var x = make(map[int]string)
答案 1 :(得分:4)
答案 2 :(得分:1)
我也刚遇到这个错误,找到了2个解决方案:
通过npm配置更改解决此问题
npm config list --json | grep "user\|unsafe-perm"
上)npm config set user 0
以root身份运行程序包脚本时要设置的UID。npm config set unsafe-perm true
设置为true以在运行程序包脚本时禁止UID / GID切换。
如果显式设置为false,则以非root用户身份安装将失败。npmjs.com建议针对此错误切换到npm版本管理器,如本article所述。
答案 3 :(得分:0)
尝试在Laravel Homestead内运行foreach (var item_db in files_path)
{
var result = item_db.Substring(item_db.Length - 3);
for (var i = 1; i < files_path.Count() + 1; i++)
{
if (result == ".db")
{
tablename = string.Format("DADLoggerTable{0}", i);
DataTable dt = ConverttoDatatable(item_db, tablename);
SaveCsv(dt, subFolderCSV, tablename);
}
}
}
时遇到此错误。
对我来说,关闭SSL验证可以解决此问题:
npm ci
根据docs,这告诉NPM跳过SSL密钥的验证,这在公司环境中可能是必需的,在公司环境中,具有自签名SSL证书的代理可能被用来拦截加密的流量。
我很确定在我的情况下没有代理,因为我从未遇到任何其他SSL问题。在虚拟机中运行npm set strict-ssl false
可能只是一些奇怪的副作用。
答案 4 :(得分:0)
在我看来,这是1 public deleteMortgageObligation(id: string): Observable<void> {
2 return this.getObligationsUrl(id).pipe(
3 switchMap(dossierIds => {
4 const endpoint = `${this.getObligationsUrl(dossierIds)}/blablabla/${id}`;
5 return this.http.delete(endpoint);
6 })
7 );
8 }
权限问题。尝试更改您的node_modules文件夹权限
node_modules
注意:您可以使用chown ubuntu:ubuntu -R node_modules //for ubuntu only
命令检查文件夹权限。